x=FINDGEN(1001)/20-25
y=(x-10)*(x+10)*sin(x)
plot,x,y
The above exercise used the function FINDGEN
to generate a vector x of values and then used operators and the SIN function
to compute a vector of y values. You can use the methods of exercise
3 to investigate the contents of these vectors. You then used the plot
procedure to create and display a graph of these vectors. Note that
a function puts the parameters inside parentheses and a procedure puts
them after the name, separated by commas.
x=FINDGEN(1001)/20-25
y=(x-10)*(x+10)*sin(x)
plot,x,y,TITLE='My First Plot',$
XTITLE='x',YTITLE='y=f(x)'
The graph should now have titles, as shown below. The parameters TITLE,
XTITLE and YTITLE called keywords. In this example they are given string
values. The strings are then used as the titles. You can experiment with
changing the strings to get different titles.
PLOT is a procedure that has many parameters.
You can read about them by using IDL online help. Select Help from the
menu bar, then select the index tab, then type Plot Procedure in the search
field to select the PLOT help. Read about some of the keyword parameters
that are available. We will use some additional keywords to cause the plot
to draw a dotted grid.
