PARTVELVEC
Name
PARTVELVEC
Purpose
Plot the velocity vectors of particles at their positions
Explanation
This procedure plots the velocity vectors of particles (at the
positions of the particles).
Category
Plotting, Two-dimensional.
Calling Sequence
PARTVELVEC, VELX, VELY, POSX, POSY [, X, Y]
Inputs
VELX: An array of any dimension, containing the x-components
of the particle velocities.
VELY: An array of the same dimension as velx, containing the
y-components of the particle velocities.
POSX: An array of the same dimension as velx, containing the
x-components of the particle positions.
POSY: An array of the same dimension as velx, containing the
y-components of the particle positions.
Optional Inputs
X: Optional abcissae values. X must be a vector.
Y: Optional ordinate values. Y must be a vector. If only X
is specified, then Y is taken equal to be equal to X.
Optional Input Keyword Parameters
FRACTION: The fraction of the vectors to plot. They are
taken at random from the complete sample. Default is
FRACTION = 1.0, use all vectors
LENGTH: The maximum vectorlength relative to the plot data
window. Default = 0.08
COLOR: Color for the vectors, axes and titles by string name or
number (see cgCOLOR). Note that if VECCOLORS is
supplied, then the COLOR keyword still specifies the
color of the axes and title. Default = 'Opposite'
OVER: Plot over the previous plot
VECCOLORS: The vector colors. Must be either a scalar, or
a vector (nmeric or string) the same size as VELX.
Set to COLOR by default.
WINDOW - Set this keyword to plot to a resizeable graphics window
Plot All other keywords available to cgPlot (e.g. AXISCOLOR,
Keywords: LINESTYLE, XRANGE) are available (via _EXTRA)
Outputs
This procedure plots the velocity vectors (VELX,VELY) at the
positions of the particles, (POSX,POSY). If X and Y are not
specified, then the size of the plot is such that all vectors
just fit within in the plot data window.
Side Effects
Plotting on the current device is performed.
Example
Generate some particle positions and velocities.
POSX=RANDOMU(seed,200)
POSY=RANDOMU(seed,200)
VELX=RANDOMU(seed,200)-0.5
VELY=RANDOMU(seed,200)-0.5
Plot the particle velocities.
PARTVELVEC, VELX, VELY, POSX, POSY
Example using vector colors.
POSX=RANDOMU(seed,200)
POSY=RANDOMU(seed,200)
VELX=RANDOMU(seed,200)-0.5
VELY=RANDOMU(seed,200)-0.5
magnitude = SQRT(velx^2 + vely^2)
LOADCT, 5, NCOLORS=254, BOTTOM=1 ; Load vector colors
colors = BytScl(magnitude, Top=254) + 1B
PARTVELVEC, VELX, VELY, POSX, POSY, COLOR='green', VECCOLORS=colors
Modification History
Written by: Joop Schaye (jschaye@astro.rug.nl), Sep 1996.
Added /OVER keyword Theo Brauers (th.brauers@fz-juelich.de) Jul 2002
Added VECCOLORS keyword. David Fanning (david@dfanning.com) March, 2005
Incorporate the Coyote Graphics (cg) plot programs WL January 2011