next up previous contents
Next: Colours in IDL Up: Lecture 3: More graphics Previous: Surface plots   Contents

Contour Plots

It is less visually striking, but normally more useful, to display 2-d data as a contour plot. For a basic contour plot, do:

IDL> contour,z,x,y

It's a start, but there are not very many contours and we don't know what each contour represents. You can use the levels keyword to specify which contours you want:

IDL> contour,z,x,y,levels=findgen(21)/10,c_label=intarr(21)+1

Note that findgen(n) returns an n-element floating point array (use indgen for integers) with the elements set to [0, 1, 2, ...n-1] so the above example will produce a plot with 21 contours going from 0 to 2 with a spacing of 0.1 between the contours. The clabel keyword makes IDL label the contours, for which it is set to one.



John Marsham 2005-04-22