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 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

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

_______________________________________________

Matplotlib-users mailing list

Matplotlib-users at python.org

https://mail.python.org/mailman/listinfo/matplotlib-users