next up previous contents
Next: Exercise 1: Plotting some Up: Section 2: Introduction to Previous: Using where on a   Contents

Plotting two lots of 1D data on the same graph

We can now plot temperature against height
window,0,retain=2
; note data(3,*) are temperatures and data(2,*) are heights 
wtempandheight=where(data(3,*) gt -200 and data(3,*) lt 500 and data(2,*) gt 0 and data(2,*) lt 30000.)

plot,(data(3,*))(wtempandheight),(data(2,*))(wtempandheight),xtitle='Temperature (K)',ytitle='Height (m)'
It is easy to overplot dewpoints,
wtdandheight=where(data(4,*) gt -200 and data(4,*) lt 500 and data(2,*) gt 0 and data(2,*) lt 30000.)
oplot,(data(4,*))(wtdandheight),(data(2,*))(wtdandheight),linestyle=2
But if we want to overplot pressure againt height it is a bit trickeir as this requires a second x-axis.

;Supress x-xaxis with xstyle=4 
;Force y - axis range with ystyle=1 
yr=[0,15000]
pos=[0.25,0.15,0.9,0.9]
plot,(data(3,*))(wtempandheight),(data(2,*))(wtempandheight),ytitle='Height (m)',xstyle=4,ystyle=1,yrange=yr,position=pos
axis,xaxis=0,xtitle='Temperature (K)'
wpandheight=where(data(1,*) gt 0 and data(1,*) lt 200000 and data(2,*) gt 0 and data(2,*) lt 30000.)
plot,(data(1,*))(wpandheight),(data(2,*))(wpandheight),linestyle=2,/noerase,ystyle=1,yrange=yr,xstyle=4  ,position=pos
axis,xaxis=1,xtitle='Pressure (Pa)'

Note that to get this to plot neatly we have used the position keyword. Look up these new keywords in IDL help.



John Marsham 2009-12-07