Animating 3D quiver plot in 1.4.3?

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.

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.

Cheers!
Ben Root

···

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

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>

I would suggest going with the 'just remove the artist' path here unless
there is a serious performance issue.

The internal artist structure of the 3D quiver is effective for getting the
lines on the screen, but needs some re-working (it is a collection of line
segments, not of arrows, so the arrow tail and the two lines is the arrow
head are actually 3 lines in the collection).

Tom

···

On Fri, Oct 9, 2015 at 10:03 AM Benjamin Root <ben.v.root at gmail.com> wrote:

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.

Cheers!
Ben Root

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

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

_______________________________________________
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/a4e6d583/attachment-0001.html>

Oh, right, I forgot about that part.

···

On Fri, Oct 9, 2015 at 10:16 AM, Thomas Caswell <tcaswell at gmail.com> wrote:

I would suggest going with the 'just remove the artist' path here unless
there is a serious performance issue.

The internal artist structure of the 3D quiver is effective for getting
the lines on the screen, but needs some re-working (it is a collection of
line segments, not of arrows, so the arrow tail and the two lines is the
arrow head are actually 3 lines in the collection).

Tom

On Fri, Oct 9, 2015 at 10:03 AM Benjamin Root <ben.v.root at gmail.com> > wrote:

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.

Cheers!
Ben Root

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

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

_______________________________________________
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/585c725d/attachment.html>