
NCL > Application examples > Basic examples
XyPlot example 15
Creating stacked plots
This example is created using HLU C library calls, HLU FORTRAN library calls, or NCL. It demonstrates how to create a set of four "stacked" XyPlots and how to use annotations to simplify the control and sizing of all the plots. The names of the source files for this example are xy15c.c, xy15f.f, and xy15n.ncl.
Discussion
This module discusses how to create this plot using HLU function calls or NCL. The resource file used with this example is called xy15.res.This example illustrates the creation of a set of four "stacked" XyPlots. Each plot has the same X axis. By making the top three plots into annotations of the bottom plot, all four plots can be manipulated as a unit. To demonstrate this concept, the second frame sets the viewport of the base plot. Because all the annotations have their "amResizeNotify" resource set to True (in the resource file), all the annotation plots resize themselves proportionally to the change in the size of the base plot. Each plot draws a variation of a sinusoidal curve.
A more 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 xy15c.c.
Creating the plot using HLU FORTRAN library calls
The HLU FORTRAN program that generates this plot is called xy15f.f.
Creating the plot using NCL
The NCL script that generates this plot is called xy15n.ncl.
The data
The data for this plot is generated from within the HLU program.
How to run this example
The examples are installed in the following locations:
- $NCARG_ROOT/lib/ncarg/hluex/xyplot/xy15c.c
- $NCARG_ROOT/lib/ncarg/hluex/xyplot/xy15f.f
- $NCARG_ROOT/lib/ncarg/nclex/xyplot/xy15n.ncl
- $NCARG_ROOT/lib/ncarg/resfiles/xyplot/xy15.res