NCL > Application examples > Basic examples

Primitives example 5

How to draw primitives overlayed on a MapPlot object

This example shows how to draw graphic primitives overlayed on a MapPlot using HLU library calls or NCL. Data polygons are used to color global zones and data polylines mark the zonal boundaries. The names of the example codes that create this plot are pr05c.c, pr05f.f, and pr05n.ncl.

Discussion

Resources are controlled through a resource file called pr05.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 pr05c.c.

Creating the plot using HLU FORTRAN library calls

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

Creating the plot using NCL

The HLU NCL program that generates this plot is called pr05n.ncl.

The data

The data are generated from within the program or script.

How to run this example

There are three ways to produce this example: by using a C program (pr05c.c), a FORTRAN program (pr05f.f), or an NCL script (pr05n.ncl).

The examples are installed in the following locations:

  • $NCARG_ROOT/lib/ncarg/hluex/primitives/pr05c.c
  • $NCARG_ROOT/lib/ncarg/hluex/primitives/pr05f.f
  • $NCARG_ROOT/lib/ncarg/nclex/primitives/pr05n.ncl
You can copy this example and run it by typing "ng4ex pr05c", "ng4ex pr05f", or "ng4ex pr05n". A copy of the source file will be placed in your current working directory. The source code will be compiled (if appropriate) and automatically run for you.