NCL > Application examples > Basic examples

ContourPlot example 4

Multiple contour plots on a single frame

This example demonstrates how to create the plot using HLU C, HLU FORTRAN library calls, or NCL. The names of the example codes that create this plot are cn04c.c, cn04f.f, and cn04n.ncl.

Discussion

Some of the resources are controlled through a resource file called cn04.res.

A detailed discussion about how to create the plot appears in the comments of the source code for the example.

Creating the plot using HLU C library calls

The HLU C program that generates this plot is called cn04c.c.

Creating the plot using HLU FORTRAN library calls

The HLU FORTRAN program that generates this plot is called cn04f.f.

Creating the plot using NCL

The NCL script that generates this plot is called cn04n.ncl.

The data

The data for this example is generated using the GENDAT subroutine. However, the NCL script reads data from an ASCII data file called cn04n.asc.

How to run this example

There are two ways to produce this example: by using a C program (cn04c.c) or a FORTRAN program (cn04f.f). The examples are installed in the following locations:

  • $NCARG_ROOT/lib/ncarg/hluex/contourplot/cn04c.c
  • $NCARG_ROOT/lib/ncarg/hluex/contourplot/cn04f.f
  • $NCARG_ROOT/lib/ncarg/nclex/contourplot/cn04n.ncl
The resource file for this example is located in:

  • $NCARG_ROOT/lib/ncarg/resfiles/contourplot/cn04.res
The data for the NCL version of this example is located in:

  • $NCARG_ROOT/lib/ncarg/data/asc/cn04n.asc
You can copy this example and run it by typing "ng4ex cn04c", "ng4ex cn04f", or "ng4ex cn04n". A copy of the source file and resource file will be placed in your current working directory. The source code will be compiled and automatically run for you.