;E.G. TV'ed IMAGE, CONTINOUS COLORBAR, LINE CONTOURS sz=200 array_1 = (intarr(sz)+1.)#indgen(sz);fltarr(200)#fltarr(200)= ;fltarr (200,200) array_2 = indgen(sz)#(intarr(sz)+1) pos=[0.13,0.17,0.95,0.85] set_plot,'ps' device,file='~lecjm/eg_tv_image.eps',/encapsulated,/color loadct,39 tvimage,array_1,position=pos,/keep_aspect_ratio,/minus_one contour,array_2,indgen(sz),indgen(sz),position=pos,/noerase,$ levels=indgen(21)*10.,c_labels=intarr(21)+1,xtitle='x', ytitle='y' device,/close $gv ~lecjm/eg_tv_image.eps &
This is a bit dry but try,
pro eg_plot_lem ;+ ;An example of contouring vertical velocities on top of ice mixing ratios ;for irregularly gridded LEM data ;JOHN MARSHAM 13/4/05 ;E.G. TV'ed IMAGE, CONTINOUS COLORBAR, LINE CONTOURS ;- xsz=502 ;xsize of data ysz=91 ; ysize of data zn=fltarr(ysz) ;heights of LEM levels (m) imr=fltarr(xsz,ysz) ;ice mixing ratio array (kg/kg) w=imr*0. ; vertical velocity array (m/s) ;Open gzipped files (no need to unzip!) openr,12,'~lecjm/public_html/Teaching/IDL_course/Data/run0764_dg33_zn.dat.gz',/compress readu,12,zn close,12 openr,12,'~lecjm/public_html/Teaching/IDL_course/Data/run0764_dg33_imr.dat.gz',/compress readu,12,imr close,12 openr,12,'~lecjm/public_html/Teaching/IDL_course/Data/run0764_dg33_w.dat.gz',/compress readu,12,w close,12 ;Interpolate to a regular height grid to greyscale data ;Should creare a .pro to do this! newz=indgen(201)*100.;0 to 20000 m in 100 m intervals newimr=fltarr(xsz,201) neww=fltarr(xsz,201) for i = 0,xsz-1 do newimr(i,*)=interpol(imr(i,*),zn,newz) for i = 0,xsz-1 do neww(i,*)=interpol(w(i,*),zn,newz) ;Defining plotting requirements lev=(indgen(21)-10)*.25 ;-4,-3.5,.....4 contour levels for w cls=[2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0] ;linestyle for contours pos=[0.17,0.17,0.95,0.8] ; position in window bs_min=0. ; min imr (kg/kg) for greyscale bs_max=0.0002 ; max imr (kg/kg) for greyscale bottom=50 ; min zpos to plot top=100 ; max zpos to plot lhs=0 ; left most position to plot rhs=200 ; right most position to plot ;arrays for plotting plot_imr=rebin(newimr(lhs:rhs,bottom:top),rhs-lhs+1,(top-bottom+1)*5) plot_w=rebin(neww(lhs:rhs,bottom:top),rhs-lhs+1,(top-bottom+1)*5) plot_z=rebin(newz(bottom:top),(top-bottom+1)*5) !p.charsize=1.5 loadct,0 Big=256l*256*256-1 ; white !p.color=0 ; black !p.background=big ; white window,0,retain=2 tvimage,Big-bytscl(plot_imr,min=bs_min,max=bs_max),position=pos,$ /minus_one contour,plot_w,indgen(rhs-lhs+1)*100.,plot_z,position=pos,/noerase,$ levels=lev,xtitle='x (m)', ytitle='y (m)',c_linestyle=cls,$ subtitle='Contours of vertical velocity at 0.25 m/s intervals' colorbar,range=[bs_min,bs_max]*1000.,title='IMR (g/kg)',format='(f4.2)',$ divisions=4 write_png,'~lecjm/imr_w_2d_greyscale.png',tvrd() ;OR ;E.G.FILLED CONTOURED IMAGE OF VAR_1 (REGULAR CONTOUR SPACING) ; DISCRETE COLORBAR + LINE CONTOURS OF VAR_2 window,1,retain=2 ncon=5 cols=[255,200,150,100,50,10] contour,plot_imr,indgen(rhs-lhs+1)*100.,plot_z,position=pos,/noerase,$ levels=[0,1.e-5,5.0e-5,1.e-4,1.5e-4],xtitle='x (m)', ytitle='y (m)',/fill,$ c_color=cols contour,plot_w,indgen(rhs-lhs+1)*100.,plot_z,position=pos,/noerase,$ levels=lev,xtitle='x (m)', ytitle='y (m)',c_linestyle=cls,$ subtitle='Contours of vertical velocity at 0.25 m/s intervals' ncon=16 ; number of contours cdif=1.5e-5; contour spacing cmin=0 ; min contour value conval=fltarr(ncon) cols=244-12*findgen(ncon+1); Colours to use (0 to 244 in jumps of 12) conval=(findgen(ncon)*cdif)+cmin ; values of contours: 0 to 0.000225000 window,1,retain=2 contour,plot_imr,indgen(rhs-lhs+1)*100.,plot_z,position=pos,/noerase,$ levels=conval,xtitle='x (m)', ytitle='y (m)',/fill,$ c_color=cols contour,plot_w,indgen(rhs-lhs+1)*100.,plot_z,position=pos,/noerase,$ levels=lev,xtitle='x (m)', ytitle='y (m)',c_linestyle=cls,$ subtitle='Contours of vertical velocity at 0.25 m/s intervals' conmin=min(conval) conmax=max(conval) nopos = [0.15,0.88,0.93,0.93] !p.position=nopos xtckvalues=findgen(ncon+1)*(conmax-conmin)/(ncon-1)+conmin xv=xtckvalues([0,4,8,12,16]) contour,(findgen(ncon+2))#[1,1],$ 1000.*(findgen(ncon+2)-1)*(conmax-conmin)/(ncon-1)+conmin,[0,1],/cell_fill,/closed,$ levels=(findgen(ncon)+1),$ c_colors=cols,/noerase,xrange=[conmin,conmax],xstyle=1,$ xticks=5,xticklen=1,ystyle=5,title='IMR (g/kg)', $ xtickv=xv*1000.,charsize=1.,charthick=1 write_png,'~lecjm/imr_w_2d_contoured.png',tvrd()