window,0,retain=2 x=[1.,2.,3.,4.] y3=x^3. plot,x,y3 y2=x^2. oplot,x,y2,linestyle=2
Note that the deafult is white on black. You can change this with
!p.color=0 !p.background=255``!'' in IDL is always used to access or change system variables or defaults, ''!p.'' refers to plotting variables.
x,y and y3 are arrays of numbers. Arrays are just single variables that contain lists or multi-dimensional grids of numbers.
You can easily refer to indiviual elements of an array using, for example,
print,x(1)Note IDL counts from zero!
Or several elements,
print,x(0:1)
Or all elements
print,x(*)
``*'' is most useful when you have a multi-dimenisoanl array and you can use ``*'' refer to a whole row or column etc. For example
a=[[1,2,3],[1,2,3]; create a 2D array print,a(0,*) print,a(*,0)
You will spend a lot of time messing around with arrays of numbers and plotting them using IDL during your PhD and we will return to them later.