|
Object Programming: Working with Plots and Graphs |
|
Contour objects create a set of contour lines from data stored in a rectangular array or in a set of unstructured points. Contour objects can consist either of lines or of filled regions.
To create a contour object, provide a vector or two-dimensional array containing the values to be contoured to the IDLgrContour::Init method. For example, the following statement creates a contour from a two-dimensional array returned by the IDL DIST function:
mycontour = OBJ_NEW('IDLgrContour', DIST(20))
See IDLgrContourfor details on creating contour objects.
Contour objects have a number of properties that determine how they are rendered. See IDLgrContour Properties for a complete listing. The following code displays the contour object created above in the X-Y plane.
| Note In order to display the contour as on the plane (rather than as a three-dimensional image), you must set the PLANAR property of the contour object equal to one and explicitly set the GEOMZ property equal to zero. |
mywindow = OBJ_NEW('IDLgrWindow')
myview = OBJ_NEW('IDLgrView', VIEWPLANE_RECT=[0,0,19,19])
mymodel = OBJ_NEW('IDLgrModel')
data = DIST(20)
mycontour = OBJ_NEW('IDLgrContour', data, COLOR=[100,150,200], $
C_LINESTYLE=[0,2,4], /PLANAR, GEOMZ=0, C_VALUE=INDGEN(20))
myview->Add, mymodel
mymodel->Add, mycontour
mywindow->Draw, myview
This results in the following figure.
A more complex example using a contour object is shown in the contour demo. To start the demos, type demo at the IDL command prompt. Both the terrain elevation and vehicle tire data sets are displayed using the contour object.
IDL Online Help (March 06, 2007)