[Matplotlib-users] Animating 3D quiver plot in 1.4.3?

Benjamin Root ben.v.root at gmail.com
Fri Oct 9 15:56:00 CEST 2015

Part of the problem with the 3d version of quiver is that it isn't based
off of the 2D version of quiver, so there is no "set_UVC" method available.
The 3D quiver is just a Line3DCollection object, so you do have access to
the set_segments() method, which accepts a MxN(m)x3 array of vertices where
M is the number of lines, and N(m) is the number of vertices for line m.

To clear a quiver plot, one could just remove the artist, but that is a bit
heavy-handed. I think the set_segments() approach above should be
sufficient. Note that if you want to do anything special with the colors or
some other property, that might be tricker, but doable.

Ben Root

On Thu, Sep 17, 2015 at 4:37 AM, plottingberra <isabellahuang7 at gmail.com>

> Hello!
> I want to create a 3D animation that animates the trajectory of a flying
> object. The FuncAnimation object has been really helpful in doing so, but
> now I want to plot an arrow (using the Quiver class) depicting the
> acceleration vector at the object's position in its path.
> My key problem is that I only want exactly one arrow on the plot at a time.
> Currently I am able to create an animated trail of arrows, but I want to
> clear the arrows that were plotted before a certain time t. I know that
> there exists a method set_UVC that allows for this sort of data updating,
> but I cannot get it to work for the 3D case.
> Alternatively, I tried searching for a method that clears the entire quiver
> plot (inelegant, but should work for my loop), but was unsuccessful in
> finding one that works.
> I'd like to ask, then:
> 1. Is there a way of making set_UVC work for my 3D case?
> 2. What is the proper way to clear a quiver plot?
> Thank you so much!
> --
> View this message in context:
> http://matplotlib.1069221.n5.nabble.com/Animating-3D-quiver-plot-in-1-4-3-tp46181.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users at python.org
> https://mail.python.org/mailman/listinfo/matplotlib-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20151009/1031fef5/attachment.html>

More information about the Matplotlib-users mailing list