I have a data set containing the recorded data from a car's motion (latitude,longitude, and heading). I'd like to plot the (lat,lon) points on a 2D plot with a unit vector pointing in the direction of the car's heading at each point. The heading is given in azimuth degrees so I think I would first have to convert that to radians then calculate the (x,y) point that represents the head of the unit vector.

I don't have any trouble plotting the (lat,lon) points but I have no idea about the vectors. I'm pretty new to Octave but I do know at least basic C/C++. An animated plot would be even better if anyone knows how to set that up.


1 Answer 1


The command you are likely looking for is quiver. It only does 2D vector field plots, and you may have to normalize your vector lengths yourself. It also requires that all of your points be on a rectangular grid, although there is likely a work around for that.

quiver(x, y, u, v);

For an animated plot, you want to draw a single location and vector(still using quiver) inside a loop and use the pause command for animation. Since this sounds a little like a homework problem I will leave the details to you.

  • $\begingroup$ Thanks! It looks like Octave has a built in demo on quiver too. $\endgroup$
    – JDD
    Sep 4, 2012 at 13:17
  • $\begingroup$ Actually, quiver seems to work with any list of points, not just a rectangular grid. $\endgroup$
    – Bill Barth
    Sep 4, 2012 at 13:17
  • $\begingroup$ I have only played with the matlab version. I remembered fighting it to plot my polar data, but didn't remember the details of my difficulty. $\endgroup$ Sep 4, 2012 at 15:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.