Message Boards Message Boards

5 Replies
2 Total Likes
View groups...
Share this post:

How Am I Misunderstanding ListVectorPLot Syntax?

I am teaching myself simple classical mechanics and have a model of a particle moving in a central,conservative force field in 2D. As a function of time, I can plot the radius vector (nice ellipse as expected) or the velocity vector (...). What I want to do is try and plot this as a vector field so I can visualize the velocity and positions changing with time in one plot. ListVectorPlot is supposed to be able to take a list of {xi,yi} points (I think that these would be the x and y components of my radial position vector at time i) and, at each such point, plot an associated vector field point {vxi,vyi}. I have assumed that the vxi and vyi would be the corresponding x and y components of my velocity vector at the same time step. Clearly I have misunderstood the Mathematica inline help for the function as I just get an error message saying that I am not presenting a valid vector field dataset or list of datasets.

I would be most grateful if someone can point out where I am going wrong. In the trivial example attached I attempt to plot the system at t=0 when my position vector is {5,0} and my velocity vector is {0,2}. I had hoped to see a vertical line, 2 units long, plotted 5 units to the right of the origin on the x-axis.

POSTED BY: David Mackay
5 Replies

Mr. Keith,

Please feel free to send that suggestion via
or The clearer the description, the better.

POSTED BY: Bruce Miller
Posted 9 years ago

Thank you, Bruce. I have done so.

Kind regards,


POSTED BY: David Keith
Posted 9 years ago

I would really like to see a future release change the handling of the vector field arguments when VectorPoints->All is elected. It is clear that for the case in which the vector field elements represent sampled values from a continuous field, and interpolation is required, the interpolation routine needs to place constraints on the field description to make interpolation meaningful. But in the case where the individual base-direction pairs are to be plotted as-given, there is no need for interpolation. It would be nice if the interpolation requirements were eliminated, and the vectors just plotted.

This update should be innocuous. I don't see that is should break past usage, since it only relieves a constraint, and cannot then force an error onto any previously working use.

POSTED BY: David Keith


Many thanks for your reply. I will change the number of {xi,yi} {vxi,vyi} pairs and add the VectorPoints option as you suggest.

OK. Did that and it seems to be working-the inline help could be a little more explicit in future releases perhaps?

POSTED BY: David Mackay
Posted 9 years ago

I have always found ListVectorPlot confusing and dysfunctional. It really wants a data set that it can consider to be sampled points in a continuous field. It then interpolates and plots a representation of the field, but not necessarily at the sampled points. The documentation says that VectorPoints->All will cause it to plot at the given points, rather than interpolate. But even then it seems to want a dataset that is a qualified representative of a continuous field. There does not seem any way to tell it to forget about the need to interpolate -- just plot the points given. Below there are three vectors. But if given only one you will get an error that it is not a valid vector field dataset.

ListVectorPlot[{{{5, 0}, {0, 2}}, {{0, 5}, {1, 2}}, {{0, 0}, {1, 1}}},
  VectorPoints -> All]

enter image description here

POSTED BY: David Keith
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract