Draws vectors on the given workstation.
procedure wmvect ( wks  : graphic, x [*] : float, y [*] : float, dx [*] : float, dy [*] : float )
Arrays of any dimensionality specifying X and Y coordinate values.dx
Arrays of any dimensionality specifying X and Y components of the vectors at the associated (x,y) coordinates.
If you want to draw vectors over a map that is defined on gridded data, then you could use a vector plot with vcGlyphStyle set to one of the appropriate styles. If you want to draw vectors over a map that is defined on non-gridded data, then use wmvectmap.
The base of the vector will be at world coordinate (X,Y). The arguments dx and dy specify the vector components in the X and Y directions.
There are several parameters that control the vector apperance. The parameters VRS and VRN establish the relationship between vector lengths [the value sqrt(dx*dx+dy*dy)] and the length of the vector displayed on the plot. By default a vector length of 10. gets mapped to a line that is 2% of the maximum width of the output plot. You will most likely want to change these values.
The parameters applicable to wmvect are:
- VCH - controls the vector arrow head size
- VCC - controls the vector color.
- VCW - controls the linewidth scale factor.
- VVA - controls the angle between the arrow and tail
The procedure wmvect does not call frame.
Vectors are not plotted where the input data has missing values.
See example 8 on the weather symbols application page.
The following code:
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" begin ; ; Draw four orthogonal vectors. ; cmap = (/ \ (/ 1.0, 1.0, 1.0 /), \ ; color index 0 - white (/ 0.0, 0.0, 0.0 /), \ ; color index 1 - black (/ 1.0, 0.0, 0.0 /), \ ; color index 2 - red (/ 0.0, 0.0, 1.0 /) \ ; color index 3 - blue /) ; ; Create a PostScript workstation. ; wks = gsn_open_wks("ps","test") gsn_define_colormap(wks,cmap) x = new(4,float) y = new(4,float) x(:) = 0.5 y(:) = 0.5 ; ; Set some vector parameter values. ; wmsetp("vrs - reference vector size",50.) wmsetp("vrn - NDC size of a reference vector size",0.3) wmsetp("vcc - vector color",2) wmsetp("vcw - vector linewidth scale factor",4.) u = (/50., 0., 0., -50./) v = (/ 0., 50., -50., 0./) wmvect(wks, x, y, u, v) ; ; Mark origin. ; gsres = True ; Indicate you want to set some resources. gsres@gsMarkerColor = 3 ; Change marker color. gsres@gsMarkerSizeF = 20. ; Increase marker size by a factor of 20. gsn_polymarker_ndc(wks,0.5,0.5,gsres) ; Draw the polymarker. ; ; Plot an informational label box. ; wmvlbl(wks, 0.8 ,0.2) frame(wks) endDraws four orthogonal vectors.