proc vector displays a group of vectors, using the
current data set,
current plot area.
proc vector can render arrows, plain lines,
error bars (I bars), T bars,
Vector direction can be specified in degrees, radians, or by directly supplying the coordinates
of the second point.
Vector length or magnitude can be constant for all vectors, or controlled by your data.
See also the
vector gallery examples.
yfield must be supplied.
Vector direction and magnitude must be specified, either by a) supplying
dirfield along with magfield or constantlen; or
b) supplying x2field and y2field.
arrow | barb | errorbar | tbar
Controls the type of vector to draw. Default is arrow
Data fields holding the X coordinate and Y coordinate of the vector starting point.
Data field holding a representation of the direction.
By default this is degrees, where 0 is at the top, and rotating clockwise,
but other options are available, see dirunits, dirrange, zeroat, and clockdir.
This attribute may be specified to cause all vectors to be h inches/cm.
Example: constantlen: 0.6
Data fields holding the X coordinate and Y coordinate of the vector ending point.
This is an alternative way of specifying the direction and length of the vector, so
if these are specified, then dirfield and magfield are not needed.
Data-driven vector length
Data field holding a representation of the magnitude or length of the vector.
By default this is in absolute units (inches or cm),
but other options are available, see lenunits and lenscale.
lenfield is an alias to magfield.
absolute | data | x | y
Allows the contents of lenfield to be either absolute units (the default),
or data units.
h is a scaling factor; the contents of lenfield will be
multiplied by h. Default is 1.0.
Data-driven vector color
If specified, the color (and any other
for the vector will be controlled using
the contents of this data field, using the
(the legend serves as a table to map data values to colors, etc).
If specified, the color (and any other
) for the vector will be controlled using
the contents of this data field directly.
For example, to control vector color, this data field could hold values like this:
Vector appearance details
Controls the color, width, etc. of the line portion of the vector.
Controls the length of the arrowhead, in inches/cm. Default is 0.15.
Controls the fatness of the arrowhead. Default is 0.4.
Controls the color of the arrowhead. By default this will be the
same as the line.
Controls the length of tails when error bars or t bars are being rendered.
h is in absolute units (inches or cm).
yes | no
Default is yes, which causes vectors to be clipped to the plotting area.
Use no to allow vectors to range past the plot area limits.
Vector direction details
A range for the values in dirfield. For example, if dirrange is given
as 100, a value of 50 would be displayed at 180 degrees.
Example: dirrange: 12
degrees | radians
Default is degrees. If radians is specified,
dirfield is taken to be radians.
Example: dirunits: radians
top | right | bottom | right
Controls where a zero degree vector will point. Default is top.
+ | -
Controls whether progressively higher directional values will
cause the vector to move clockwise (+) or counterclockwise (-).
Default is +.
Selecting data rows
Select certain records for plotting, based on a conditional expression.
Example: select: @@4 = B
Set a legend label for this set of vectors. Legend must be displayed
later using proc legend. The legend entry will identify the vector by showing a line segment only
The \\n construct can be used to force a line break when the legend is displayed,
or the label can be wordwrapped using proc legend wraplen attribute (2.32+).
Drawing wind barbs
Set type to barb.
For best results, use constantlen to set the size of the barb's stem.
The original wind barbs code was contributed by Andrew Phillips.
big medium small tiny
Sets the limits for drawing different sized barbs on the stem of a wind
barb. The default for the big triangular barb is 50, the medium sized
(full length, 1 line) barb is 10, small sized barb (half length) is 5,
tiny barbs are just the stem drawn half length is 2. The tiny barbs are
not the official way to show very low wind, which normally is to draw a
dot instead, which can be done using a scatterplot and a few selects.
Example: barblimits: 40 12 8 2
The angle the barbs are drawn relative to the stem, in degrees. Default is 120.