X

NV5 Geospatial Blog

Each month, NV5 Geospatial posts new blog content across a variety of categories. Browse our latest posts below to learn about important geospatial information or use the search bar to find a specific topic or author. Stay informed of the latest blog posts, events, and technologies by joining our email list!



Not All Supernovae Are Created Equal: Rethinking the Universe’s Measuring Tools

Not All Supernovae Are Created Equal: Rethinking the Universe’s Measuring Tools

6/3/2025

Rethinking the Reliability of Type 1a Supernovae   How do astronomers measure the universe? It all starts with distance. From gauging the size of a galaxy to calculating how fast the universe is expanding, measuring cosmic distances is essential to understanding everything in the sky. For nearby stars, astronomers use... Read More >

Using LLMs To Research Remote Sensing Software: Helpful, but Incomplete

Using LLMs To Research Remote Sensing Software: Helpful, but Incomplete

5/26/2025

Whether you’re new to remote sensing or a seasoned expert, there is no doubt that large language models (LLMs) like OpenAI’s ChatGPT or Google’s Gemini can be incredibly useful in many aspects of research. From exploring the electromagnetic spectrum to creating object detection models using the latest deep learning... Read More >

From Image to Insight: How GEOINT Automation Is Changing the Speed of Decision-Making

From Image to Insight: How GEOINT Automation Is Changing the Speed of Decision-Making

4/28/2025

When every second counts, the ability to process geospatial data rapidly and accurately isn’t just helpful, it’s critical. Geospatial Intelligence (GEOINT) has always played a pivotal role in defense, security, and disaster response. But in high-tempo operations, traditional workflows are no longer fast enough. Analysts are... Read More >

Thermal Infrared Echoes: Illuminating the Last Gasp of a Dying Star

Thermal Infrared Echoes: Illuminating the Last Gasp of a Dying Star

4/24/2025

This blog was written by Eli Dwek, Emeritus, NASA Goddard Space Flight Center, Greenbelt, MD and Research Fellow, Center for Astrophysics, Harvard & Smithsonian, Cambridge, MA. It is the fifth blog in a series showcasing our IDL® Fellows program which supports passionate retired IDL users who may need support to continue their work... Read More >

A New Era of Hyperspectral Imaging with ENVI® and Wyvern’s Open Data Program

A New Era of Hyperspectral Imaging with ENVI® and Wyvern’s Open Data Program

2/25/2025

This blog was written in collaboration with Adam O’Connor from Wyvern.   As hyperspectral imaging (HSI) continues to grow in importance, access to high-quality satellite data is key to unlocking new insights in environmental monitoring, agriculture, forestry, mining, security, energy infrastructure management, and more.... Read More >

1345678910Last
7165 Rate this article:
No rating

Using IDL 8 Graphics (a.k.a. New Graphics)

Anonym

I’ve been using Direct Graphics (DG) in IDL since 1993. I was initially hesitant about IDL 8 Graphics (christened “New Graphics” on the comp.lang.idl-pvwave newsgroup; I’ll refer to them as NG), but I’ve been pleasantly surprised by how well they work. In particular, I like how their syntax mirrors DG and how I can use them programmatically. I also like how they handle color and how easily they make publication-ready PostScript and PNG files (among other formats). Here’s a short example of working with NG. If you’d like, please try these commands in IDL. Start by making variables to represent one cycle of a sine and a cosine wave:

 t = findgen(361)*!dtor x = sin(t) y = cos(t)

Display the sine wave:

 p = plot(t, x)

Note how I called PLOT as a function. (You can still call the DG PLOT routine as a procedure.) The PLOT function returns a reference—here, the variable “p” —that can be used to control the graphic. For example, I can use “p” to change the line color to red:

 p.color = 'red'

and the graphic updates immediately. I specified the color red by name; you could also use an RGB triple. Next, I’ll add titles to the plot:

 p.xtitle = 'Time' p.ytitle = 'Amplitude' p.title = 'Sine and Cosine Waves'

I could’ve set these properties through identical keywords in the call to PLOT. I can display the cosine wave on the same axes as the sine wave with another call to PLOT:

 q = plot(t, y, color='blue', /overplot)

The OVERPLOT keyword is the NG analog to the DG OPLOT procedure. I’ll also display a zero line:

 !null = plot(p.xrange, [0,0], linestyle='dotted', /overplot)

Note how I used “p” to get the current x-axis range of the plot. Last, I’ll add a legend positioned in the lower left corner of the graphic. Don't include the zero line in the legend.

 p.name = 'Sine' q.name = 'Cosine' pq_lgd = legend(target=[p,q], position=[2.0,-0.6], /data)

Here’s a screenshot of the window that results from these steps (this is from the Linux side of my laptop): Screen capture of NG window on Linux The graphic can be saved to a JPEG file with one command:

 p.save, 'plot_ex.jpg'

IDL uses the extension on the file name to determine the file type. The default resolution of the image is 600 dpi, which makes a 2598 x 2079 image on my laptop! NG won’t replace DG in every instance. For example, NG are typically slower than DG. This is especially true when displaying more than about 104 points. NG may not be for everyone. If you’re already comfortable with DG, please continue to use them. But when I think back to when I was learning how to go beyond the basics in DG, I remember it wasn’t always easy. (In particular, I remember the first time my advisor asked me to print a plot. That was a frustrating day. Or two.) I hope that new users of IDL will try NG, and I hope that NG just makes sense to them. If you’d like to learn more about using NG, please continue to follow me on this blog; I’ll post numerous examples of using them in the coming weeks and months.

Please login or register to post comments.