NCL > Application examples > Basic examples

XyPlot example 4

How to create an XyPlot with multiple lines

This XyPlot example can be created using HLU C library calls, HLU FORTRAN library calls, or NCL. It demonstrates how to create a plot that contains multiple lines. The name of the source files for this example are xy04c.c, xy04f.f, and xy04n.ncl.

Discussion

This module discusses how to create this plot using HLU function calls or NCL. A resource file is included with this example, and it is called xy04.res. This file is used to change the default resource settings for the plot. Some of the XyPlot line resources are tweaked in the resource file to show how to change the appearance of the lines.

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

Creating the plot using HLUs

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

Creating the plot using HLU FORTRAN library calls

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

Creating the plot using NCL

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

The data

The data for this plot is created by calls within the HLU program or NCL script.

How to run this example

This example can be created using a C program (xy04c.c), a FORTRAN program (xy04f.f), or an NCL script (xy04n.ncl). The examples are installed in the following locations:

  • $NCARG_ROOT/lib/ncarg/hluex/xyplot/xy04c.c
  • $NCARG_ROOT/lib/ncarg/hluex/xyplot/xy04f.f
  • $NCARG_ROOT/lib/ncarg/nclex/xyplot/xy04n.ncl
The resource file for this example is located in:

  • $NCARG_ROOT/lib/ncarg/resfiles/xyplot/xy04.res
You can copy this example and run it by typing "ng4ex xy04c", "ng4ex xy04f", or "ng4ex xy04n". 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.