perspective

Hi all,
I am not sure this is the right place for my question, but I don?t really know where to ask?
I would like to know if there is a chance for matplolib to provide the same 3D plot perspective as the perp() function in R or from the plot3D package from Karline Soetaert (based on persp()) in R

http://www.r-bloggers.com/creating-surface-plots/

http://www.r-bloggers.com/3d-plots-in-r/

I found nothing on how to change perspective aspect in mplot3d. I am afraid it is not possible to work on the depth of the perspective in a mplot3d plot, is anyone knows how to do it ?

Does anyone think it would be possible in a near future ?

Thanks
Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160321/dfd04767/attachment-0001.html>

Sorry for the long delay in replying. It seems like your email got held up
on the listserve.

Looking at perps(), it seems like it is just doing ax.plot_wireframe() and
some camera angle settings, which can be set via ax.view_init():

view_init(self, elev=None, azim=None)
     Set the elevation and azimuth of the axes.

     This can be used to rotate the axes programatically.

     'elev' stores the elevation angle in the z plane.
     'azim' stores the azimuth angle in the x,y plane.

     if elev or azim are None (default), then the initial value
     is used which was specified in the :class:`Axes3D` constructor.

Does that help?

Cheers!
Ben Root

···

On Mon, Mar 21, 2016 at 5:37 AM, Eric Gayer <egayer at gmail.com> wrote:

Hi all,
I am not sure this is the right place for my question, but I don?t really
know where to ask?
I would like to know if there is a chance for matplolib to provide the
same 3D plot perspective as the perp() function in R or from the
plot3D package from Karline Soetaert (based on persp()) in R

Creating surface plots | R-bloggers

3D Plots in R | R-bloggers

I found nothing on how to change perspective aspect in mplot3d. I am
afraid it is not possible to work on the depth of the perspective in a
mplot3d plot, is anyone knows how to do it ?

Does anyone think it would be possible in a near future ?

Thanks
Eric

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
Matplotlib-users Info Page

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160417/8d75b11b/attachment.html&gt;

I see what you mean. There have been some people asking for that feature.
And there is some preliminary support for it built in, in fact. In
mplot3d.proj3d, there is:

def persp_transformation(zfront, zback):
    a = (zfront+zback)/(zfront-zback)
    b = -2*(zfront*zback)/(zfront-zback)
    return np.array([[1,0,0,0],
                     [0,1,0,0],
                     [0,0,a,b],
                     [0,0,-1,0]
                     ])

However, I haven't looked into integrating it into mplot3d (pull requests
are welcomed). Some people have done some hacking, but I never heard back
on the results of it. I think if you search the mailing list archives for
perspective projection, you might find some tidbits.

Seriously, projections are not my specialty, so pull requests would be
greatly welcomed!

Ben Root

Hi Ben,

Thanks for your answer, maybe I didn?t well explained what I was looking
for, I did play around with ax.view_init() but there is no elevation or
angle that change anything in the way the perspective is presented.
What I am looking for is to find a way (and I am actually not sure it is
possible) to change apparent depth of the 3D view.
I attached an image that show the difference between the two
representations (persp() and plot_wireframe with ax_init(60,30))
We feel a greater depth with the R figure than with matplotlib. Closest
thing seems bigger in the R plot. Comparing R plot to Matplolib plot it is
like comparing perspective view to orthographic view.

I hope you see what I mean :slight_smile: I don?t really know how to explain it
actually.
Basically it would be awesome if we could change something like the
perspective factor with matplotlib, so we could chose how big would appear
closest things and then how small would appear farthest things.

Thanks again for your help
Eric

Sorry for the long delay in replying. It seems like your email got held up
on the listserve.

Looking at perps(), it seems like it is just doing ax.plot_wireframe() and
some camera angle settings, which can be set via ax.view_init():

> view_init(self, elev=None, azim=None)
> Set the elevation and azimuth of the axes.
>
> This can be used to rotate the axes programatically.
>
> 'elev' stores the elevation angle in the z plane.
> 'azim' stores the azimuth angle in the x,y plane.
>
> if elev or azim are None (default), then the initial value
> is used which was specified in the :class:`Axes3D` constructor.

Does that help?

Cheers!
Ben Root

Hi all,
I am not sure this is the right place for my question, but I don?t really
know where to ask?
I would like to know if there is a chance for matplolib to provide the
same 3D plot perspective as the perp() function in R or from the
plot3D package from Karline Soetaert (based on persp()) in R

Creating surface plots | R-bloggers

3D Plots in R | R-bloggers

I found nothing on how to change perspective aspect in mplot3d. I am
afraid it is not possible to work on the depth of the perspective in a
mplot3d plot, is anyone knows how to do it ?

Does anyone think it would be possible in a near future ?

Thanks
Eric

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
Matplotlib-users Info Page

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160417/25c61d61/attachment-0001.html&gt;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: example.png
Type: image/png
Size: 149748 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160417/25c61d61/attachment-0001.png&gt;

···

On Sun, Apr 17, 2016 at 12:17 PM, Eric Gayer <egayer at gmail.com> wrote:

On Apr 17, 2016, at 4:51 PM, Benjamin Root <ben.v.root at gmail.com> wrote:
On Mon, Mar 21, 2016 at 5:37 AM, Eric Gayer <egayer at gmail.com> wrote:

Thanks Ben for your help,

I?ll look deeper into persp_transformation(), I have seen it a wild ago but it didn?t appear straightforward enough at that time? so I asked the mailing list first.
Anyway I will definitely pull a request hoping for this feature to be available soon :slight_smile:
Thanks again
Eric

···

On Apr 17, 2016, at 6:27 PM, Benjamin Root <ben.v.root at gmail.com> wrote:

I see what you mean. There have been some people asking for that feature. And there is some preliminary support for it built in, in fact. In mplot3d.proj3d, there is:

def persp_transformation(zfront, zback):
    a = (zfront+zback)/(zfront-zback)
    b = -2*(zfront*zback)/(zfront-zback)
    return np.array([[1,0,0,0],
                     [0,1,0,0],
                     [0,0,a,b],
                     [0,0,-1,0]
                     ])

However, I haven't looked into integrating it into mplot3d (pull requests are welcomed). Some people have done some hacking, but I never heard back on the results of it. I think if you search the mailing list archives for perspective projection, you might find some tidbits.

Seriously, projections are not my specialty, so pull requests would be greatly welcomed!

Ben Root

On Sun, Apr 17, 2016 at 12:17 PM, Eric Gayer <egayer at gmail.com> wrote:
Hi Ben,

Thanks for your answer, maybe I didn?t well explained what I was looking for, I did play around with ax.view_init() but there is no elevation or angle that change anything in the way the perspective is presented.
What I am looking for is to find a way (and I am actually not sure it is possible) to change apparent depth of the 3D view.
I attached an image that show the difference between the two representations (persp() and plot_wireframe with ax_init(60,30))
We feel a greater depth with the R figure than with matplotlib. Closest thing seems bigger in the R plot. Comparing R plot to Matplolib plot it is like comparing perspective view to orthographic view.

I hope you see what I mean :slight_smile: I don?t really know how to explain it actually.
Basically it would be awesome if we could change something like the perspective factor with matplotlib, so we could chose how big would appear closest things and then how small would appear farthest things.

Thanks again for your help
Eric

<example.png>

On Apr 17, 2016, at 4:51 PM, Benjamin Root <ben.v.root at gmail.com> wrote:

Sorry for the long delay in replying. It seems like your email got held up on the listserve.

Looking at perps(), it seems like it is just doing ax.plot_wireframe() and some camera angle settings, which can be set via ax.view_init():

> view_init(self, elev=None, azim=None)
> Set the elevation and azimuth of the axes.
>
> This can be used to rotate the axes programatically.
>
> 'elev' stores the elevation angle in the z plane.
> 'azim' stores the azimuth angle in the x,y plane.
>
> if elev or azim are None (default), then the initial value
> is used which was specified in the :class:`Axes3D` constructor.

Does that help?

Cheers!
Ben Root

On Mon, Mar 21, 2016 at 5:37 AM, Eric Gayer <egayer at gmail.com> wrote:
Hi all,
I am not sure this is the right place for my question, but I don?t really know where to ask?
I would like to know if there is a chance for matplolib to provide the same 3D plot perspective as the perp() function in R or from the plot3D package from Karline Soetaert (based on persp()) in R

Creating surface plots | R-bloggers

3D Plots in R | R-bloggers

I found nothing on how to change perspective aspect in mplot3d. I am afraid it is not possible to work on the depth of the perspective in a mplot3d plot, is anyone knows how to do it ?

Does anyone think it would be possible in a near future ?

Thanks
Eric

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
Matplotlib-users Info Page

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160417/81d1aa0b/attachment-0001.html&gt;