; ; the idea is that you copy and paste these into your idl session ; to see what happens. ; ; +++++++++++++++++++++++++++++++++ ; Some simple plots + ; +++++++++++++++++++++++++++++++++ ; this one we did before x = findgen(100)/100.*2.*!pi plot,x,sin(x) ; Hint: use the index to find what this findgen thingy is. ; Note that idl chooses the x and y ranges for you. Which can go ; wrong: plot,x,10000+sin(x) ; What does this do? plot,x,10000+sin(x),/xs,/ys ; Better, but not quite perfect. ; And this? plot,x,10000+sin(x),/xs,/ys,yr=[9998,10002] ; Or this plot,x,sin(x),/iso ; some more plot,x,sin(x),psym=4 ; plot,x,sin(x),psym=-4,xr=[0,15],/xs oplot,x,cos(x),linestyle=2,thick=2 legend,[' sin(x) ',' cos(x)'],linestyle=[0,2],psym=[4,0],/right ; Hang on, I get an error. This legend command does not work! ; Go on the web to find one. Mine is at ~tt/idl/cosmoplotter/legend.pro ; This is another fancy one, which I made earlier: ; http://icc.dur.ac.uk/~tt/IDL/sin_fancy.jpg"> ; I made this with plot,x,sin(x),xtitle=textoidl('\theta'),ytitle=textoidl('sin(\theta)') ; Oops: again that does not work for me. You'll need to install the ; textoidl package. Let's do this later. ; More than one window window,2,xsize=300,ysize=300 plot,x,sin(x),psym=-4,xr=[0,15],/xs wset,0 plot,x,cos(x),psym=-4,xr=[0,15],/xs : Note: if you change between windows, idl forgets your limits. So you cannot oplot once ; you've moved out of a window, either by making a new one ; (window, ...), or by changing using wset. ; BTW, wdelete,0 does what you'd expect from it. ; +++++++++++++++++++++++++++++++++ ; Colors + ; +++++++++++++++++++++++++++++++++ ; Look at this plot: http:icc.dur.ac.uk/~tt/IDL/colors.jpg. ; I made it with: ; loadct,39 ; window,0 ; x=findgen(255) ; color=findgen(255) ; plot,x,x,/nodata & for i=0,254 do oplot,[x[i]],[x[i]],psym=4,color=color[i] ; Did that work for you? If not, you may have to tell idl what screen ; you are using. I needed to say ; cat $(HOME)/.idl_startup if(!version.os_family eq 'unix') then device, true_color=24 window, /free, /pixmap, colors=-10 wdelete, !d.window device, retain=2, decomposed=0, set_character_size=[10,12] device, get_visual_depth=depth print, 'Display depth: ',depth print, 'Colour table size: ',!d.table_size loadct,39,/silent scale = float(!d.table_size)/256. black = fix( 0.*scale) blue = fix( 70. *scale) cyan = fix( 100.*scale) green = fix( 140.*scale) yellow = fix( 190.*scale) orange = fix( 210.*scale) red = fix( 250.*scale) white = fix( 255.*scale) ; Now this should work too: wset,0 x = findgen(100)/100.*2*!pi plot,x,sin(x) oplot,x,cos(x),color=red legend,[' sin(x) ',' cos(x)'],linestyle=[0,0],color=[black,red],/right ; +++++++++++++++++++++++++++++++++++++++++ ; a simple contour plot of a Gaussian + ; +++++++++++++++++++++++++++++++++++++++++ npts = 256 ; number of pts nsig = 4. ; number of sigma x = -nsig + findgen(npts)/float(npts)*2*nsig Gs = fltarr(npts,npts) for j=0,npts-1 do begin $ & for i=0,npts-1 do begin $ & Gs[i,j] = exp(-(x[i]^2+x[j]^2)/2.) $ & endfor $ & endfor contour,Gs,x,x,nlev=255,/iso,/fill ; now try loadct,11 contour,Gs,x,x,nlev=255,/iso,/fill ; or xloadct ; for even more fun.