Previous Getting Started with IDL: 2-D Plots Next

Using the iPlot Tool

The iPlot tool's primary design is to display plot data, though the tool is capable of much more once the data is plotted. The iPlot tool can display multiple types of plots and allows you to manipulate and edit the displays.

Displaying a 2D Plot

The first task is to display plot data. Here is a simple example of how to display a plot.

At the IDL command line, enter:

iPlot, RANDOMU(seed, 20)  

 

Figure 4-1: A Simple 2D Plot Using the iPlot Tool

Figure 4-1: A Simple 2D Plot Using the iPlot Tool

Displaying an Overplot

Once you have plotted data, you may overplot new plot data in the original iPlot window. Overplotting is the process of plotting new data over the top of original data or datasets for the purpose of analyzing or comparing more than one dataset at a time.

For example, in order to overplot cosine data onto a plot of sine wave data follow these steps:

  1. Create a variable named "theory" to contain sine wave data to be plotted:
  2. theory = SIN(2.0*FINDGEN(200)*!PI/25.0)*EXP(-0.02*FINDGEN(200))  
    

     

  3. Plot theory using iPlot:
  4. iPlot, theory   
    

     

    Figure 4-2: Sin Wave Data Plotted

    Figure 4-2: Sin Wave Data Plotted

     

  5. Create a variable named "newtheory" which stores cosine data to be used for overplotting:
  6. newtheory = COS(2.0*FINDGEN(200)*!PI/25.0)*EXP(-0.02*FINDGEN(200))  
    

     

  7. Now overplot the new cosine data onto your original plot:
  8. iPlot, newtheory, /OVERPLOT  
    

     

    Figure 4-3: Cosine Data Overplotted on Sine Data

    Figure 4-3: Cosine Data Overplotted on Sine Data

     


    Note
    You can also overplot in the iPlot tool any other way you can load new data into the existing iPlot tool (for example, using File  Open).

Modifying Plots

The iPlot tool allows you many options for modifying and manipulating your plots, such as displaying 3D plots, displaying polar plots, adding error bars, legends, colorbars, curve fitting, filtering, and annotating among other things. For much more information on working with the iPlot tool, see Working with Plots.

  IDL Online Help (March 06, 2007)