NCL > Application examples > Basic examples

Basic example 6

How to size and position objects

This is an introductory example that shows how to position objects on an output device and how to change their sizes. A simple color table is also defined and used for changing the color of a curve in an XyPlot.

Discussion

This module demonstrates how to create an XyPlot object and a TextItem object, and then draw them at different positions and scales on a plot. The example also defines procedures for drawing, positioning, and scaling plot objects and text objects.

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 example is called basic06c.c.

Creating the plot using HLU FORTRAN library calls

The HLU FORTRAN program that generates this example is called basic06f.f.

Creating the plot using NCL

The NCL program that generates this plot is called basic06n.ncl.

The data

The data for this plot is generated internally by the example code.

How to run this example

The examples are installed in the following locations:

  • $NCARG_ROOT/lib/ncarg/hluex/basic/basic06c.c
  • $NCARG_ROOT/lib/ncarg/hluex/basic/basic06f.f
  • $NCARG_ROOT/lib/ncarg/nclex/basic/basic06n.ncl
You can copy this example and run it by typing "ng4ex basic06n", "ng4ex basic06c", or "ng4ex basic06f". A copy of the source file will be placed in your current working directory and automatically run for you.