next up previous contents
Next: Another Program Up: Lecture 1: Getting Started Previous: Other IDL notes   Contents

A First Plot

 
x = [1, 2, 4, 5, 6.7, 7, 8, 10 ]
y = [40, 30, 10, 20, 53, 20, 10, 5]

 
help,x  
X               FLOAT     = Array[8]
help
% At $MAIN$
X               FLOAT     = Array[8]
Y               INT       = Array[8]
Compiled Procedures:
    $MAIN$

Compiled Functions:

plot,x,y

plot,x,y,title='Should he resign?',xtitle='weeks',ytitle='Popularity'

  1. plot is an IDL procedure
  2. The data, x and y, are positional parameters - the order they come in matters.
  3. Optional things are passed as keyword parameters (an important IDL routine like plot usually has many of these).
  4. You can supply keywords in any order you like.

To overplot:

y2 = [30, 28, 8, 19, 50, 22, 12, 6]
oplot,x,y2,linestyle=2

The plot in the graphics window will disappear if you cover it up unless:

IDL> window,0,retain=2
(I got fed up with this that I defined a procedure w so that w,0 does this).



lecjm 2008-11-06