
NCL > Application examples > Basic examples
VectorPlot example 6
How to use a scalar field to determine the color of the vector arrow fill
This example can be created using HLU function calls or NCL. It demonstrates how to use a scalar field to determine the color of the vector arrow fill. It also shows how to draw a VectorPlot as an overlay of a MapPlot. The names of the source files for this example are vc06c.c, vc06f.f, and vc06n.ncl.
Discussion
This module discusses how to create this plot using NCL or HLU C or FORTRAN calls. A resource file is included with this example, and it is called vc06.res. This file is used to change the default resource settings for the plot.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 vc06c.c.
Creating the plot using HLU FORTRAN library calls
The HLU FORTRAN program that generates this plot is called vc06f.f.
Creating the plot using NCL
The NCL script that generates this plot is called vc06n.ncl.
The data
The data for this plot is from a netCDF file (created by NCL) called ex01B1_uv300.hs.nc.The data file is located in your NCAR Graphics data directory in a subdirectory called "cdf". You can get the name of the data directory by typing "ncargpath data" at your shell prompt. If you have netCDF installed on your system, then you can change directory to where the netCDF file resides and type "ncdump -h ex01B1_uv300.hs.nc" to view the header information for this data file.
How to run this example
This example can be created using a C program (vc06c.c), a FORTRAN program (vc06f.f), or an NCL script (vc06n.ncl). The example is installed in the following locations:
- $NCARG_ROOT/lib/ncarg/hluex/vectorplot/vc06c.c
- $NCARG_ROOT/lib/ncarg/hluex/vectorplot/vc06f.f
- $NCARG_ROOT/lib/ncarg/nclex/vectorplot/vc06n.ncl
- $NCARG_ROOT/lib/ncarg/resfiles/vectorplot/vc06.res
- $NCARG_ROOT/lib/ncarg/data/cdf/ex01B1_uv300.hs.nc