Overplotting Vectors in IDL
QUESTION: I am trying to plot a 2D vector field. I want a plot with arrows on it representing the magnitude and direction of the vector at that location. I've tried VELOVECT and PLOT_FIELD, but they both seem to require 2D vectors for the vector magnitudes and location and I have one element vectors for the vector magnitudes and locations. (Each point has an XY location and a UV magnitude, and is represented by a single index into these four vectors.) Short of gridding all my data to 2D arrays, is there any alternative? This seems like something IDL should provide.
![]()
ANSWER: Well, what "seems" likely is not always the case. :-(
And, there are other problems with VELOVECT and PLOT_FIELD besides the ones you mention. For example, they don't allow overplotting onto an already existing plot (such as a map projection) and they don't accept other PLOT keywords that you would sometimes like to use. The alternative many people use is the PARTVELVEC program from the NASA IDL Astronomy Library web page. It seems to be much more robust than the routines that come with IDL.
You can find an example of a vector plot using PARTVELVEC in the Coyote Plot Gallery.
![]()
Last Updated 14 March 2005
