Supercomputing Institute Technical User Support

 

IDL: 2-D Plotting

  1. Simple Plotting
  2. Plotting with Data Sets
  3. LIVE_PLOT

Simple Plotting

Simple plots can be charted using the PLOT procedure. Each call to PLOT establishes the plot window (the rectangular area enclosed by the axis), the plot region (the box enclosing the plot window and its annotation), the axis types (linear or logarithmic), and the scaling.

First, we'll plot a simple graph using a sine function. Use the FINDGEN function here to specify the dimensions of the array. The FINDGEN function returns a single-precision, floating-point array, with the specified dimension, where each element of the array is set to the value of its one-dimensional subscript.  We also use a constant in creating this data (!PI).  The character (!) is used to indicate constant pre-defined values.

1. First, create a value for the X axis:
x=2*!PI/100*findgen(100)
2. Now, use PLOT to visualize the array:
plot,sin(x)
Also, additional data can be added, as before, using the OPLOT procedure.  Frequently, the color index, linestyle, or line thickness parameters are changed in each call to OPLOT to distinguish the data sets.

Now use OPLOT to plot the new information over the existing plot:

1. Plot at twice the frequency:
oplot,sin(2*x)
2. Plot at three times the frequency:
oplot,sin(3*x)
The results are shown in the following figure.

Plotting with Data Sets

To demonstrate IDLs capability to read a data set and plot it, we will use the template and data set used in Reading and Writing Data.
1. Plot the first set of data on temperatures which is stored in Temp1
plot,plot_ascii.Time,plot_ascii.Temp1
Now add titles to the simple plot graph using the TITLE, XTITLE, and YTITLE keywords. Using these simple keywords, IDL allows you to add a title to your plot as well as descriptive titles for your X and Y axis.
2. Plot with titles:
plot,plot_ascii.Time,plot_ascii.Temp1,title='Temperature Over Time', $
xtitle='Time in Seconds',ytitle='Temperature Celsius'

LIVE_PLOT

The LIVE_PLOT procedure allows you to create an interactive plotting environment. Once plotted, you can double click on a section of the plot to display a properties dialog. A set of buttons in the upper left corner of the image window allows you to print, undo the last operation, redo the last undone operation, copy, draw a line, draw a rectangle, or add text. Using any of several auxiliary routines, you can control your LIVE window after it is created.
2. Create a LIVE plot
live_plot,plot_ascii.Temp1,plot_ascii.Temp2, $ name={data:['Temp1','Temp2']}
The result is shown in the following figure:



 
This information is available in alternative formats upon request by individuals with disabilities. Please send email to alt-format@msi.umn.edu or call 612-624-0528.

HOME | QUESTIONS | FEEDBACK
Employment | Events | Links | People | Programs | Publications | Support | Welcome
 


URL: http://www.msi.umn.edu/software/fast/tutorial/fast-starting.html
This page last modified on Friday, 03 November, 2000,  09:10:02 CDT  
Please direct questions or problems to help@msi.umn.edu  
Website related questions or problems should be dirrected to webmaster@msi.umn.edu