Ploting one-dimensional data: {Gumley, 6.1-6.6} The basic IDL plotting command is plot. Recall how to get documentation about an IDL procedure: For example, to check how to use the procedure PLOT, do the following: IDL> ? plot ; or look for "Graphic Keywords" or on the web: Functional listing of IDL routines: http://idlastro.gsfc.nasa.gov/idl_html_help/Functional_List_of_IDL_Routines.html Alphabetical listing of IDL routines: http://www.physics.nyu.edu/grierlab/idl_html_help/idl_alph.html IDL> x=FINDGEN(360)*!DTOR IDL> y=SIN(x) IDL> PLOT,y ; y plotted vs the element number IDL> PLOT,x,y ; y plotted vs x IDL> PLOT,x,y,XSTYLE=1,YRANGE=[-1.5,1.5] IDL> PLOT,x,y,XSTYLE=1,YRANGE=[-1.5,1.5],XTITLE='angle',YTITLE='sin(angle)' IDL> PLOT,x,SIN(x),XSTYLE=1,YRANGE=[-1.5,1.5],LINESTYLE=0 You can plot additional lines on an existing plot using OPLOT. Note that you cannot use XSTYLE or YRANGE with OPLOT, because they don't draw a new set of axes. IDL> OPLOT,x,SIN(-x),LINESTYLE=1 ; LINESTYLE changes the line style IDL> OPLOT,x,COS(x),LINESTYLE=2 IDL> OPLOT,x,SIN(2*x),PSYM=2 ; PSYM changes the plot symbol IDL> OPLOT,x,COS(2*x),PSYM=5 IDL> OPLOT, x,SIN(3*x),PSYM=-2 ; same as PSYM=2, but this connects the points IDL> DEVICE,DECOMPOSED=0 IDL> LOADCT,33 ; load a new color table IDL> PLOT,x,y,XSTYLE=1,YRANGE=[-1.5,1.5],THICK=2.5,COLOR=10,BACKGROUND=200 note, THICK=1.0 is the default line thickness IDL> PLOT,x+1,(x+1)^2,/YLOG,COLOR=200,BACKGROUND=100 ; logarithmic axes IDL> radius=FINDGEN(100)*0.01 IDL> angle=4.*!PI*radius IDL> PLOT,radius,angle,/POLAR,COLOR=200,BACKGROUND=100 ; polar coordinates You can draw on top of an existing plot using PLOTS: IDL> PLOT,x,SIN(x),XSTYLE=1,YRANGE=[-1.5,1.5],LINESTYLE=0 IDL> PLOTS,[0,2*!PI],[0,0] IDL> PLOTS,[!PI,!PI],[-1.5,1.5],LINESTYLE=1 plotting coordinates: DATA: x and y measured in the plot data - the default DEVICE: x and y measured in pixels NORMAL: x and y go from 0 to 1 in window You can use PLOTS with any set of coordinates: IDL> PLOT,x,SIN(x),XSTYLE=1,YRANGE=[-1.5,1.5],LINESTYLE=0 IDL> PLOTS,[0.5,0.5],[0,1],/NORMAL IDL> PLOTS,[0,1],[0.3,0.3],/NORMAL You can convert between coordinate systems using CONVERT_COORD: IDL> PLOT,x,SIN(x),XSTYLE=1,YRANGE=[-1.5,1.5],LINESTYLE=0 IDL> xline=[0,2*!PI] IDL> yline=[0,0] IDL> devline=CONVERT_COORD(xline,yline,/data,/to_device) IDL> HELP,devline IDL> PLOTS,devline[0,0:1],devline[1,0:1],LINESTYLE=1,/DEVICE