C programs for generating contour plots
During development of the Green's function method for simulating mass transport by microvessel networks, I have been unable to find suitable open-source C programs for generating contour plots. The following subroutines are designed to address this problem. Both subroutines plot contours of a function specified by numerical data on a rectangular grid, and generate PostScript output.
Download source code: contours_C.zip (remove _.txt from the file name and then unzip). If using Internet Explorer, right-click and hit 'Save Target As'.
contr_lines.cpp - generates contour lines and labels with contour heights
contr_shade.cpp - generates contour lines with colored shading between contours and a color bar
Input variables are:
m n nl: dimensions of array, no. of contour levels
scalefac: determines size of plot
xmin xmax ymin ymax: boundaries of box
cl(nl): array of contour levels
zv(m,n): array of heights
Additional variables are defined within the subroutines and may need to be changed for specific applications.
This code is free to use at your own risk. Feedback and/or acknowledgement are appreciated. Email email@example.com.
Note: This code makes use of nrutil.h and nrutil.cpp as placed in the public domain by Numerical Recipes at http://apps.nrbook.com/c/index.html.
Version 2 - August 2011
In this version, contr_shade has been improved by combining polygons with the same color before writing to the PostScript file. Also some new options have been added. This yields much smaller output files, but longer processing times.
Download source code: ContourAug2011.zip (remove _.txt from the file name and then unzip). If using Internet Explorer, right-click and hit 'Save Target As'.
GUI version, including grid generator - August 2011
GUI versions of contr_shade and contr_lines, Version 2, together with a meshing program that accepts ASCII data in XYZ format (space or tab delimited) and generates a grid file that can then be contoured using contr_shaded. These versions were provided by Steve Ferrell firstname.lastname@example.org and questions about these versions should be addressed to him.
Download executable files and sample data: ContouringToolsv2.zip (remove _.txt from the file name and then unzip). If using Internet Explorer, right-click and hit 'Save Target As'.
Contents of the zip file:
Mesher.exe - GUI version of meshing program, generates z-elevation grid files for contouring.
contour_shaded.exe - GUI version of color shaded contouring routine, accepts .mes files from Mesher.exe.
contour_bw.exe - GUI version of line contouring routine, accepts .mes files from Mesher.exe.
MtStHelens.xyz - ASCII survey data of Mt. St. Helens.
mt-sthelens.mes - 400x400 mesh of Mt. St. Helens generated by the Mesher program.
crater_lake_subset_700x700.mes - 700x700 mesh of Crater Lake generated by the Mesher program.
T.W. Secomb, February 2009, updated 5 September 2011.
Arizona Health Sciences Center
1501 N. Campbell, Rm. 4104
PO Box 245051
Tucson, AZ 85724
Ina Gittings Undergraduate Program (520) 621-4850
Copyright 2014 © Arizona Board of Regents. The University of Arizona, Tucson, Arizona