Previous Getting Started with IDL: Surfaces and Contours Next

Contour Data and the Command Line

Contour data can be visualized and manipulated at the IDL Command Line. First, we need to create a two-dimensional dataset which we will then visualize. See Accessing Binary Surface Data for instructions to open this data set. Once you have read the file into IDL, you are ready to move on to visualizing the data set three-dimensionally

Displaying a Contour

Another way to view a two-dimensional array is as a contour plot. A simple contour plot of the Data can be created.

  1. Set the array size back to its original 350 by 450 size by entering:
  2. MARBELLS=MARBELLS_BINARY.MARBELLS  
    

     

  3. Plot the contour:
  4. CONTOUR, MARBELLS  
    

     

    Figure 7-9: Contour Plot

    Figure 7-9: Contour Plot

     

    That command was very simple, but the resulting plot was not as informative as it could be.

     

  5. Create a customized CONTOUR plot with more elevations and labels by entering:
  6. CONTOUR,MARBELLS,NLEVELS=8,C_LABELS=[0,1]  
    

     

    Figure 7-10: Contour Plot with Elevation Labeled

    Figure 7-10: Contour Plot with Elevation Labeled

     

    By using the NLEVELS keyword, CONTOUR was told to plot eight equally-spaced elevation levels. The C_LABELS keyword specifies which contour levels should be labeled. By default, every other contour is labeled. C_LABELS allows you to override this default and explicitly specify the levels to label.

     

  7. Similarly, you can create a filled contour plot where each contour level is filled with a different color (or shade of gray) by setting the FILL keyword. To do this, enter:
  8. CONTOUR,MARBELLS,NLEVELS=8,/FILL  
    

     

    Figure 7-11: Contour Plot with Filled Contour Plot

    Figure 7-11: Contour Plot with Filled Contour Plot

     

  9. To outline the resulting contours, make another call to CONTOUR and set the OVERPLOT keyword to keep the previous plot from being erased.
  10.  

    You can add tickmarks that indicate the slope of the contours (the tickmarks point in the downhill direction) by setting the DOWNHILL keyword:

    CONTOUR,A,NLEVELS=8,/OVERPLOT,/DOWNHILL  
    

     

    Figure 7-12: Contour Plot with Downhill Tickmarks Labeled

    Figure 7-12: Contour Plot with Downhill Tickmarks Labeled

     

  11. CONTOUR plots can be rendered from a three-dimensional perspective.
  12.  

    First, set up the default 3-D viewing angle by entering:

    SURFR  
    

     

  13. By using the T3D keyword in the next call to CONTOUR, the contours will be drawn as seen from a 3-D perspective. Enter:
  14. CONTOUR,MARBELLS,NLEVELS=8,/T3D  
    

     

    Figure 7-13: Contour Plot with 3-D Contour Plot

    Figure 7-13: Contour Plot with 3-D Contour Plot

  IDL Online Help (March 06, 2007)