next up previous contents
Next: Contour Plots Up: Lecture 3: More graphics Previous: Lecture 3: More graphics   Contents

Surface plots

Perhaps the most immediate way of displaying a data set like our example is as a surface plot. Type

IDL> window,0,retain=2
IDL> surface,z,x,y

and look at the result. Depending on your terminal, the axis labels may be a bit small. You can use the 'charsize' keyword to make them more legible. Just as with the line plots we saw in the first class, you can label your axes: here we can label the z axis too. Try:

IDL> surface,z,x,y,charsize=2.5,xtitle='East',ytitle='North',ztitle='Alt.'

Maybe you want black on white instead of white on black. Try

IDL> surface,z,x,y,charsize=2.5,xtitle='East',ytitle='North',$
ztitle='Alt.',color=0,background=16777215
color=0 is black and color 256*256*256-1=16777215 is white (try typing print, 256*256*256 into IDL. The answer is wrong because it's using short integers). In this case ``color'' and ``background'' are keywords (i.e. optional) that control the colors used in the surface routine. If you get bored of setting them each time try
IDL> !p.color=0
IDL> !p.background=16777215
IDL> surface,z,x,y,charsize=2.5,xtitle='East',ytitle='North',ztitle='Alt.'

``!p.color'' and ``!.background'' are global variables i.e. the defaults used if color=blah and background=blah are not set. Note these are not reset by the ``.f'' command. Many keywords can be used like this, e.g. !p.charsize, !p.thick, !x.thick, !y.thick etc

Like most IDL procedures, surface has lots of keywords to enable you to tweak the plot to look how you want it to look. Note particularly the ax and az keywords, which let you look at the plot from different angles. Try these examples:

IDL> surface,z,x,y,ax=5 
IDL> surface,z,x,y,ax=85

You can also do:

IDL> surface,z,x,y ,bottom=200

to colour the lower surface in a different colour.

An alternative to the wire frame is a shaded surface. This is produced by the shade_surf command:

IDL> shade_surf,z,x,y


next up previous contents
Next: Contour Plots Up: Lecture 3: More graphics Previous: Lecture 3: More graphics   Contents
John Marsham 2005-04-22