Dr R R Burton, Institute for Atmospheric Science

School of Earth and Environment

ralph@env.leeds.ac.uk


Creating contour plots using Excel




This is one way to use FORTRAN to output formatted data for use in Excel.

We first of all generate some test data. The data used as an example here are generated by the FORTRAN program below. Suppose the data represent concentration values defined on an x-y grid where the x-axis goes from 0 to 5000m, and the y-axis from 0 to 10000m, and the gridsize (for this simple example) being 10x10:


Click
here to download this program.


Note the use of the FORTRAN "format" statements; this writes our data in a fixed-column format. Also note that the axes scaling is also written to the same file. Note that you will have to change the FORMAT statements, and axis definitions, to suit your own problem and gridsizes. More about FORMAT descriptors can be found here.
The data should look like this (click to enlarge):


Click here to download this data.


Note that the "borders" of this file (i.e. the first row and the first column) contain information about the x and y axis, and all data is formatted into columns. Next, open Excel and use "open file". Select the name of the file where your data is stored; in this case "test.dat". Then, when the text import wizard appears, select the "Fixed width" button, and click through the following stages (you shouldn't have to change anything else.)
If this is successful, you should see something similar to the following:



Next, select the cells containing your data, and click on the "Chart Wizard" button. From the chart type box, select "Surface", and pick the "contour surface chart with colours" type option:



Click through the successive stages to finish the plot. At one stage you can enter the x- and y-axis labels:



And you can choose to embed the chart in your worksheet or create a new sheet for your chart. If you choose the latter you should see the contour plot:



Also you can alter the x, y and z scalings (the z scaling refers to the bar at the side which defines the contour levels). For example, to increase the number of contour lines, click on the bar, and enter "0.1" in the major unit box:



This has the effect of increasing the number of contour levels:



By clicking on the x-axes, etc., you can refine further the appearance of your plot.