Contour Plotting Routine for IDL

Update:

An object oriented version of this routine, one that uses iContour, is now available as conmakeOBJ.

Details

  • Filename: conmake.txt (Contour Make)
  • Direct Download: conmake
    NOTE: the download is provided as a .txt format, but the file must be renamed with a .pro extension (i.e. conmake.pro) before using.
  • File Last Updated: March 14, 2006

About

A routine for making contour plots in IDL is now available for download. IDL is a program used for the processing and visualization of data. If you do not use IDL, then this code will not be useful. If you use IDL but do not know a lot about it, then this code should be helpful because the source is significantly commented. If you have any questions or suggestions please feel free to send a message through the Contact form.

This routine works by generating a contour plot in the active graphics window. The best way to make images from the plot is to use the following command immediately after running conmake:
IDL> WRITE_PNG, ''desired_path/your_filename.png'', TVRD( /TRUE )
where WRITE_PNG is a native IDL module and IDL> is the command prompt.

Examples

The minimum command line usage of this procedure is,
IDL> conmake, input, #
where input is a two dimensional array and # is the number of colors to use in the plot. Read the header of the source code for detailed notes on other parameter and keyword options.

The following images display some of the output that I have used from the conmake routine. These are the actual images produced with WRITE_PNG, and their file sizes are indicative of results you should expect for a similar setup.

contour plot

Fig. 1: Example contour illustrating axis labels and colorbar.

Fig. 1: This plot illustrates usage of the axis labels and colorbar. The command to produce this contour is,
IDL> conmake, input, xaxis, yaxis, 256, xlab=2, ylab=2, /cbar
where input (two dimensional array), xaxis (one dimensional array), and yaxis (one dimensional array) were IDL variables.

contour plot example 2

Fig. 2: Contour example illustrating use of the axis labels and minimum level settings without a colorbar. The vertical red line on the right side was not created with conmake.

Fig. 2: This image illustrates use of the axis labels and minimum level settings without a colorbar. The minlev keyword causes all data values below its value to be treated as missing data. The missing data, or noise level values in this case, are ignored. The white regions of the contour represent the absence of data. The command to produce this contour is,
IDL> conmake, input, xaxis, yaxis, 256, xlab=5, ylab=3, minlev=-18

contour plot example 3

Fig. 3: Contour example illustrating use of the axis labels, colorbar, and overplot settings. This image has been altered after initial creation in order to make it web friendly.

Fig. 3: This image shows the axis labels, colorbar, and overplot settings. The command to produce this contour is,
IDL> conmake, input, xaxis, yaxis, 256, xlab=2, ylab=2, overp=opinput
where opinput is a two dimensional array. The array to be overplotted should have the same scaling with the x and y axes as the main contour so that a sensible output results.

Leave a Reply