Is there a 3D version of the quiver plot?

I have a list of surface normals I would like to plot. Is there a way to plot a 3D vectors in matplotlib similar to how quiver plots 2D vectors?

Not at this time, but that would make a great feature request! I think the current roadblock to such a function is a bug with converting 2d arrow objects into 3d arrows.

Ben Root

···

On Thu, Mar 7, 2013 at 2:14 PM, Brickle Macho <bricklemacho@…287…> wrote:

I have a list of surface normals I would like to plot. Is there a way

to plot a 3D vectors in matplotlib similar to how quiver plots 2D vectors?

    I have a list of surface normals I would like to plot. Is there a way
    to plot a 3D vectors in matplotlib similar to how quiver plots 2D
    vectors?

Not at this time, but that would make a great feature request! I think
the current roadblock to such a function is a bug with converting 2d
arrow objects into 3d arrows.

Quiver uses a PolyCollection, and I see that there is a Poly3DCollection.

Eric

···

On 2013/03/07 9:19 AM, Benjamin Root wrote:

On Thu, Mar 7, 2013 at 2:14 PM, Brickle Macho <bricklemacho@…287… > <mailto:bricklemacho@…287…>> wrote:

Ben Root

Took a bit of digging, but I knew I remembered this question before:

http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CDMQFjAA&url=http%3A%2F%2Fmatplotlib.1069221.n5.nabble.com%2F2D-Quiver-in-Axes3D-td27944.html&ei=Pwk5UfGdLufv0QHuroD4BA&usg=AFQjCNEqlWv2vY5l2IPcje-g6B0U21wDNw&bvm=bv.43287494,d.dmQ

And the feature request is here:
https://github.com/matplotlib/matplotlib/issues/1026

In the thread I pointed out a bug that I encountered. I really hope I get some free time soon so that I can work on the various feature requests in mplot3d.

Cheers!
Ben Root

···

On Thu, Mar 7, 2013 at 4:25 PM, Eric Firing <efiring@…202…> wrote:

On 2013/03/07 9:19 AM, Benjamin Root wrote:

On Thu, Mar 7, 2013 at 2:14 PM, Brickle Macho <bricklemacho@…287… > > mailto:bricklemacho@...287...> wrote:

I have a list of surface normals I would like to plot.  Is there a way
to plot a 3D vectors in matplotlib similar to how quiver plots 2D
vectors?

Not at this time, but that would make a great feature request! I think

the current roadblock to such a function is a bug with converting 2d

arrow objects into 3d arrows.

Quiver uses a PolyCollection, and I see that there is a Poly3DCollection.

Eric

Ben Root

Thanks. I had a quick read of the thread linked, if I was a stronger/better programmer I would see if I could contribute.

For now I plan calculate/plot the angle between the normal and each the X,Y,Z planes. I hopefully the 3 subplots will visually convey sufficient information.

Brickle.

···

--

On 8/03/13 5:43 AM, Benjamin Root wrote:

On Thu, Mar 7, 2013 at 4:25 PM, Eric Firing <efiring@…202… > <mailto:efiring@…202…>> wrote:

    On 2013/03/07 9:19 AM, Benjamin Root wrote:
    >
    > On Thu, Mar 7, 2013 at 2:14 PM, Brickle Macho > <bricklemacho@…287… <mailto:bricklemacho@…287…> > > <mailto:bricklemacho@…287…>> > wrote:
    >
    > I have a list of surface normals I would like to plot. Is
    there a way
    > to plot a 3D vectors in matplotlib similar to how quiver
    plots 2D
    > vectors?
    >
    > Not at this time, but that would make a great feature request!
     I think
    > the current roadblock to such a function is a bug with converting 2d
    > arrow objects into 3d arrows.

    Quiver uses a PolyCollection, and I see that there is a
    Poly3DCollection.

    Eric

    >
    > Ben Root

Took a bit of digging, but I knew I remembered this question before:

http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CDMQFjAA&url=http%3A%2F%2Fmatplotlib.1069221.n5.nabble.com%2F2D-Quiver-in-Axes3D-td27944.html&ei=Pwk5UfGdLufv0QHuroD4BA&usg=AFQjCNEqlWv2vY5l2IPcje-g6B0U21wDNw&bvm=bv.43287494,d.dmQ

And the feature request is here:
https://github.com/matplotlib/matplotlib/issues/1026

In the thread I pointed out a bug that I encountered. I really hope I get some free time soon so that I can work on the various feature requests in mplot3d.

Cheers!
Ben Root

------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the
endpoint security space. For insight on selecting the right partner to
tackle endpoint security challenges, access the full report.
http://p.sf.net/sfu/symantec-dev2dev

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Thanks. I had a quick read of the thread linked, if I was a
stronger/better programmer I would see if I could contribute.

For now I plan calculate/plot the angle between the normal and each the
X,Y,Z planes. I hopefully the 3 subplots will visually convey sufficient
information.

Correct me if I'm wrong, but would a 2D quiver plot on top of a
contour plot work? What spaces does the surface map to/from? If your
surface can be expressed as a function f:R^2 -> R then it's equivalent
to look at its level sets, rather than the 3D picture. You can then
project the surface normals onto the plane and plot them with a 2D
quiver plot. If you want to keep the z-component information, then
you could colour the arrows according to the angle they make with the
x-y plane.

Does that make sense?

I put the original feature request in, and I think it would be useful,
but often I still find it easier to process two dimensional
information.

N.B. The above will only work for *functions* f:R^2 -> R. To
clarify, a sphere cannot be expressed this way, because the resulting
mapping would be multivalued. Using this method, two distinct surface
normals may have the same colour.

Hope that makes sense.

Best wishes,
Damon

···

On Thu, Mar 7, 2013 at 5:32 PM, Brickle Macho <bricklemacho@...287...> wrote:

Brickle.
--

On 8/03/13 5:43 AM, Benjamin Root wrote:

On Thu, Mar 7, 2013 at 4:25 PM, Eric Firing <efiring@...202...> wrote:

On 2013/03/07 9:19 AM, Benjamin Root wrote:
>
>
> On Thu, Mar 7, 2013 at 2:14 PM, Brickle Macho <bricklemacho@…287… >> > <mailto:bricklemacho@…287…>> wrote:
>
> I have a list of surface normals I would like to plot. Is there a
> way
> to plot a 3D vectors in matplotlib similar to how quiver plots 2D
> vectors?
>
>
> Not at this time, but that would make a great feature request! I think
> the current roadblock to such a function is a bug with converting 2d
> arrow objects into 3d arrows.

Quiver uses a PolyCollection, and I see that there is a Poly3DCollection.

Eric

>
> Ben Root

Took a bit of digging, but I knew I remembered this question before:

http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CDMQFjAA&url=http%3A%2F%2Fmatplotlib.1069221.n5.nabble.com%2F2D-Quiver-in-Axes3D-td27944.html&ei=Pwk5UfGdLufv0QHuroD4BA&usg=AFQjCNEqlWv2vY5l2IPcje-g6B0U21wDNw&bvm=bv.43287494,d.dmQ

And the feature request is here:
https://github.com/matplotlib/matplotlib/issues/1026

In the thread I pointed out a bug that I encountered. I really hope I get
some free time soon so that I can work on the various feature requests in
mplot3d.

Cheers!
Ben Root

------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the
endpoint security space. For insight on selecting the right partner to
tackle endpoint security challenges, access the full report.
http://p.sf.net/sfu/symantec-dev2dev

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the
endpoint security space. For insight on selecting the right partner to
tackle endpoint security challenges, access the full report.
http://p.sf.net/sfu/symantec-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Damon McDougall
http://www.damon-is-a-geek.com
Institute for Computational Engineering Sciences
201 E. 24th St.
Stop C0200
The University of Texas at Austin
Austin, TX 78712-1229

My source is an image, so technically f:R^2 -> R. Specifically I am using depth maps or (range image) what to visualise the surfaces/normals. I was planing on plotting the image as surface (hadn't work out how yet) and overlay the normal vectors. I think a 2D quiver plot on top of a contour plot may provide a useful visualisation/interpretation of the process.

Thanks for the idea.

Brickle.

···

On 8/03/13 8:37 AM, Damon McDougall wrote:

Correct me if I'm wrong, but would a 2D quiver plot on top of a
contour plot work? What spaces does the surface map to/from? If your
surface can be expressed as a function f:R^2 -> R then it's equivalent
to look at its level sets, rather than the 3D picture. You can then
project the surface normals onto the plane and plot them with a 2D
quiver plot. If you want to keep the z-component information, then
you could colour the arrows according to the angle they make with the
x-y plane.

Does that make sense?

--

I put the original feature request in, and I think it would be useful,
but often I still find it easier to process two dimensional
information.

N.B. The above will only work for *functions* f:R^2 -> R. To
clarify, a sphere cannot be expressed this way, because the resulting
mapping would be multivalued. Using this method, two distinct surface
normals may have the same colour.

Hope that makes sense.

Best wishes,
Damon

Brickle.
--

On 8/03/13 5:43 AM, Benjamin Root wrote:

On Thu, Mar 7, 2013 at 4:25 PM, Eric Firing <efiring@...202...> wrote:

On 2013/03/07 9:19 AM, Benjamin Root wrote:

On Thu, Mar 7, 2013 at 2:14 PM, Brickle Macho <bricklemacho@…287… >>>> <mailto:bricklemacho@…287…>> wrote:

     I have a list of surface normals I would like to plot. Is there a
way
     to plot a 3D vectors in matplotlib similar to how quiver plots 2D
     vectors?

Not at this time, but that would make a great feature request! I think
the current roadblock to such a function is a bug with converting 2d
arrow objects into 3d arrows.

Quiver uses a PolyCollection, and I see that there is a Poly3DCollection.

Eric

Ben Root

Took a bit of digging, but I knew I remembered this question before:

http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CDMQFjAA&url=http%3A%2F%2Fmatplotlib.1069221.n5.nabble.com%2F2D-Quiver-in-Axes3D-td27944.html&ei=Pwk5UfGdLufv0QHuroD4BA&usg=AFQjCNEqlWv2vY5l2IPcje-g6B0U21wDNw&bvm=bv.43287494,d.dmQ

And the feature request is here:
https://github.com/matplotlib/matplotlib/issues/1026

In the thread I pointed out a bug that I encountered. I really hope I get
some free time soon so that I can work on the various feature requests in
mplot3d.

Cheers!
Ben Root

------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the
endpoint security space. For insight on selecting the right partner to
tackle endpoint security challenges, access the full report.
http://p.sf.net/sfu/symantec-dev2dev

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the
endpoint security space. For insight on selecting the right partner to
tackle endpoint security challenges, access the full report.
http://p.sf.net/sfu/symantec-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

> Correct me if I'm wrong, but would a 2D quiver plot on top of a
> contour plot work? What spaces does the surface map to/from? If your
> surface can be expressed as a function f:R^2 -> R then it's equivalent
> to look at its level sets, rather than the 3D picture. You can then
> project the surface normals onto the plane and plot them with a 2D
> quiver plot. If you want to keep the z-component information, then
> you could colour the arrows according to the angle they make with the
> x-y plane.
>
> Does that make sense?

My source is an image, so technically f:R^2 -> R. Specifically I am
using depth maps or (range image) what to visualise the
surfaces/normals. I was planing on plotting the image as surface
(hadn't work out how yet) and overlay the normal vectors. I think a 2D
quiver plot on top of a contour plot may provide a useful
visualisation/interpretation of the process.

You always have the solution to install mayavi, a 3D plotting library. The
API resemble maptlotlib's and it supports 3D quiver plots.

Cheers,
N

···

On 8 March 2013 03:19, Brickle Macho <bricklemacho@...287...> wrote:

On 8/03/13 8:37 AM, Damon McDougall wrote:

Thanks for the idea.

Brickle.
--

>
> I put the original feature request in, and I think it would be useful,
> but often I still find it easier to process two dimensional
> information.
>
> N.B. The above will only work for *functions* f:R^2 -> R. To
> clarify, a sphere cannot be expressed this way, because the resulting
> mapping would be multivalued. Using this method, two distinct surface
> normals may have the same colour.
>
> Hope that makes sense.
>
> Best wishes,
> Damon
>
>> Brickle.
>> –
>>
>>
>> On 8/03/13 5:43 AM, Benjamin Root wrote:
>>
>>
>>
>> On Thu, Mar 7, 2013 at 4:25 PM, Eric Firing <efiring@…202…> wrote:
>>> On 2013/03/07 9:19 AM, Benjamin Root wrote:
>>>>
>>>> On Thu, Mar 7, 2013 at 2:14 PM, Brickle Macho <bricklemacho@…287… > >>>> <mailto:bricklemacho@…287…>> wrote:
>>>>
>>>> I have a list of surface normals I would like to plot. Is there
a
>>>> way
>>>> to plot a 3D vectors in matplotlib similar to how quiver plots 2D
>>>> vectors?
>>>>
>>>>
>>>> Not at this time, but that would make a great feature request! I
think
>>>> the current roadblock to such a function is a bug with converting 2d
>>>> arrow objects into 3d arrows.
>>> Quiver uses a PolyCollection, and I see that there is a
Poly3DCollection.
>>>
>>> Eric
>>>
>>>> Ben Root
>>>
>> Took a bit of digging, but I knew I remembered this question before:
>>
>>
http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CDMQFjAA&url=http%3A%2F%2Fmatplotlib.1069221.n5.nabble.com%2F2D-Quiver-in-Axes3D-td27944.html&ei=Pwk5UfGdLufv0QHuroD4BA&usg=AFQjCNEqlWv2vY5l2IPcje-g6B0U21wDNw&bvm=bv.43287494,d.dmQ
>>
>> And the feature request is here:
>> https://github.com/matplotlib/matplotlib/issues/1026
>>
>> In the thread I pointed out a bug that I encountered. I really hope I
get
>> some free time soon so that I can work on the various feature requests
in
>> mplot3d.
>>
>> Cheers!
>> Ben Root
>>
>>
>>
>>
------------------------------------------------------------------------------
>> Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester
>> Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the
>> endpoint security space. For insight on selecting the right partner to
>> tackle endpoint security challenges, access the full report.
>> http://p.sf.net/sfu/symantec-dev2dev
>>
>>
>>
>> _______________________________________________
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>>
>>
------------------------------------------------------------------------------
>> Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester
>> Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the
>> endpoint security space. For insight on selecting the right partner to
>> tackle endpoint security challenges, access the full report.
>> http://p.sf.net/sfu/symantec-dev2dev
>> _______________________________________________
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
>

------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the
endpoint security space. For insight on selecting the right partner to
tackle endpoint security challenges, access the full report.
http://p.sf.net/sfu/symantec-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users