IDL 8.0 introduces an entirely new graphics interface. Currently, there is no name for this system except Graphics (am I supposed to say it capitalized when talking?), so I will refer to them as function graphics because all the routines are functions instead of procedures as in most direct graphics and iTools graphics routines. This new system is easy to use, interactive, programmatically accessible, and fairly complete even in this first release.
I can only just skim the surface of the capabilities of function graphics in this post. See the online help for more details.
To create a plot using function graphics, do:
IDL> p = plot(findgen(10), color=[255, 0, 0])
The plot can be annotated from the GUI interface, but it can also be modified via the return value
p, an object which represents the newly created plot. You can get and set properties of the graphics object easily:
IDL> p.color = 'blue' ; or you could use [0, 0, 255]
The plot line automatically changes to blue.
IDL> print, p.color 0 0 255
From the command line, to find all the available properties of one of the graphics object returned from a function graphics routine, just print it:
IDL> print, p PLOT <21317> ANTIALIAS = 1 ASPECT_RATIO = 0.0000000 ASPECT_Z = 0.0000000 BACKGROUND_COLOR = 255 255 255 COLOR = 255 0 0 DEPTH_CUE = 0.00000 0.00000 [etc, rest of output omitted for brevity]
By the way, if you want to refer to colors by name in other uses in IDL, you can use the new
!color system variable:
IDL> print, !color.blue 0 0 255
You can see a listing of all of the color names available by using
IDL> help, !color, /structures ** Structure !COLOR, 147 tags, length=441, data length=441: ALICE_BLUE BYTE Array ANTIQUE_WHITE BYTE Array AQUA BYTE Array AQUAMARINE BYTE Array [etc, rest of output omitted for brevity]
Note that function graphics can be used programmatically without any graphics windows appearing on the screen:
IDL> c = contour(dist(200), /buffer) IDL> c->save, 'contour.png'
See the online help on a particular graphics object type to see its available methods, but most seem to have
WIDGET_WINDOW routine provides a way to add a function graphics window to a widget application.
One of my favorite features in the new graphics API is that LaTeX escape sequences are built-in! For example,
IDL> p = plot(findgen(10), title='Some formula: $\mu = \epsilon^2 + \tau$')
(UPDATE: there is a
TEX2IDL routine in the IDL distribution now that can be used independently of the function graphics routines.)
The following functions are part of the function graphics API:
There is much, much more to be said about function graphics, but hopefully this will get you started exploring. It will take more time to actually do some work using it to determine its shortcomings, but I think it is the most important feature of IDL 8.0.
Stay tuned for one last wrap-up article about IDL 8.0.