IDL has more than one way to produce the same result when plotting graphs. For instance, you could plot a graph like this using the the command, plot, and the keywords xtitle and ytitle:
x = findgen(10)An alternate way of doing this is with the system variable:
y = 2*findgen(10)
plot, x, y, xtitle = 'This is the X axis', ytitle = 'This is the Y axis'
x = findgen(10)Both of these code segments would give the same result.
y = 2*findgen(10)
!x.title = 'This is the X axis'
!y.title = 'This is the Y axis'
plot, x, y
Which is better to use?
In general, it is probably better to use the keyword syntax.
Once you change the system variable (e.g., change the charsize to 3) when
you compile a program, the system variable remains that way until you specifically
change it or exit IDL. That means you can compile a completely different
program and the IDL system will remember that its charsize is 3, even if
you don't want it to be that way. If you change the charsize by using
the keyword notation, it will only change the charsize for that command.
If you use system variables, it would be best to reset them to their default at the end of your program. E.g.,
!p.font=-1 ;vector/hershey fonts (0=postscript)All of the following !P System Variables work as plotting keywords, except for !p.multi.
!p.multi=0 ;one plot per page
!p.charsize=1
background | font | position | thick |
channel | linestyle | psym | title |
charsize | multi | region | ticklen |
charthick | noclip | subtitle | |
clip | noerase | T | |
color | nsum | T3D |
charsize | omargin | thick | tickv |
crange | range | tickformat | title |
gridstyle | region | ticklen | type |
margin | S | tickname | window |
minor | style | ticks |
background | nodata | title | [XYZ]ticks |
charsize | noerase | [XYZ]charsize | [XYZ]tickv |
charthick | normal | [XYZ]gridstyle | [XYZ]tick_get |
clip | nsum | [XYZ]log | [XYZ]title |
color | polar | [XYZ]margin | Ynozero |
data | position | [XYZ]minor | Zvalue |
device | psym | [XYZ]range | |
font | subtitle | [XYZ]style | |
linestyle | symsize | [XYZ]thick | |
max_value | T3D | [XYZ]tickformat | |
min_value | thick | [XYZ]ticklen | |
noclip | ticklen | [XYZ]tickname |