NCL Website header
NCL Home> Application examples> Plot techniques || Data files for some examples

Example pages containing: tips | resources | functions/procedures

Vector Effects

This page shows how to change the look of vectors via colors, thinning, changing the arrow heads, and transparency (added in version 6.1.0).
veceff_1.ncl: Change the length of vectors and color them based on magnitude.

The first frame shows a default vector plot.

vcRefLengthF sets the length of the reference vector, and vcMinFracLengthF sets the length of the smallest vector as a fraction of the reference vector.

To color vectors based on magnitude, set vcMonoLineArrowColor To False. gsnSpreadColors = True tells NCL to span the whole color map. In NCL version 6.1.0, you no longer need to set this resource to True, as the colors will be spanned automatically. In NCL versions 6.0.0 and earlier, the default is to start with the first color and use them in sequence.

New resources were introduced in version 6.1.0 to turn off the automatic span, and to specify a color palette to use with your vectors (independent of the workstation color map): vcLevelPalette and vcSpanLevelPalette.

veceff_2.ncl: Sets the size of the arrow heads.

This example is similar to the previous one, except the size of the arrow heads are made the same by setting vcLineArrowHeadMinSizeF and vcLineArrowHeadMaxSizeF to the same value.

veceff_3.ncl: Controlling the appearance of vector arrow heads.

vcFillArrowFillColor and vcFillArrowEdgeColor enable you to set the color and outline color of filled vectors.

The second and third frames show how to further control the appearance of the arrow heads using a whole set of resources: vcFillArrowWidthF, vcFillArrowMinFracWidthF, and vcFillArrowHeadMinFracXF.

veceff_4.ncl: Thinning vectors.

Use vcMinDistanceF to thin your vectors based the distance between vectors.

You can also thin your vectors simply by striding the data:

  vector = gsn_vector(wks,u(::2,::2),v(::2,::2),res)

newcolor_8.ncl: This example shows a feature added in NCL version 6.1.0: drawing partially transparent filled vectors.

The vectors are drawn fully opaque in the first frame. In the second frame, vcGlyphOpacityF is set to 0.3.