NCL > Application examples > Basic examples

Primitives example 1

How to draw basic primitives using the GraphicStyle object with default settings

This is an introductory example that shows how to set up a GraphicStyle object to draw polygons, polylines, and polymarkers. This example demonstrates how to create the plot using HLU C library calls, HLU FORTRAN library calls, and NCL. The names of the example codes that create this plot are pr01c.c, pr01f.f, and pr01n.ncl.

Discussion

This module discusses how to create this plot using HLU function calls or NCL. A resource file is not included with this example.

A detailed discussion of how this example works appears in its source code.

Creating the plot using HLU C library calls

A discussion of how to create the plot using an HLU C program is located in the source code file pr01c.c.

Creating the plot using HLU FORTRAN library calls

A discussion of how to create the plot using an HLU FORTRAN program is located in the source code file pr01f.f.

Creating the plot using NCL

A discussion of how to create the plot using an NCL script is located in the script file pr01n.ncl.

The data

This plot does not use any data.

How to run this example

There are three ways to produce this example: by using a C program (pr01c.c), a FORTRAN program (pr01f.f), or an NCL script (pr01n.ncl). The examples are installed in the following locations:

  • $NCARG_ROOT/lib/ncarg/hluex/primitives/pr01c.c
  • $NCARG_ROOT/lib/ncarg/hluex/primitives/pr01f.f
  • $NCARG_ROOT/lib/ncarg/nclex/primitives/pr01n.ncl
You can copy this example and run it by typing "ng4ex pr01c", "ng4ex pr01f", or "ng4ex pr01n". 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. The image will display to an X Window on your workstation.