On Fri, Nov 2, 2012 at 3:18 AM, Alexandr <o.pischans...@gmail.com> wrote:

> Benjamin Root <ben.root@...> writes:
>
> >
> >
> > On Thu, Jun 9, 2011 at 10:13 AM, Benjamin Root <ben.root <at> ou.edu>
> wrote:
> >
> >
> >
> >
> > On Thu, Jun 9, 2011 at 6:25 AM, Richard Hofmeister <richard.hofmeister-
> 3jvuoyhyqgombxhyh7it0rnah6klm...@public.gmane.org> wrote:
> > Hello mplot3d specialists,I would like to change the aspect ratio of the
> 3d
> axes similar to matlab's functionality with daspect() or the
> 'dataaspectratio'
> property of 3d-axes.In the end, the x-y-plane should be non-square due to
> different lengths (not range) of the x and y axis (i know that i can use
> the
> aspect property of the axes to set the x-z/y-z aspect ratio).There is also
> the
> package "scitools", which provides all the matlab-3d functions including
> daspect
> via a VTK-backend; that would be my next try.For the simple 3d-plotting
> without
> fancy shading, i would like to stick to mplot3d:
> >
> >
> >
> > Is it possible to change the axis lengths/aspect ratios
> independently?Richard
> >
> >
> >
> >
> > Richard,Good question.  I have never thought about such a feature for
> mplot3d.  Looking back at the code, it does not appear to be feasible to
> do in
> its current state, as the code seems to assume that the 3d grid is a
> constructed
> from a unit cube.  However, I will see if I can add aspect multipliers to
> the
> point calculation and get arbitrary aspects.  Maybe I can get that feature
> added
> into the upcoming 1.1.0 release.Ben Root
> >
> >
> >
> >
> > Richard,I took a look at how this might be implemented.  There would
> have to
> be some extra work to make the plots look right when experiencing changes
> in
> aspect.  I first tried an implementation of just the plot box aspect ratio
> (pbaspect) as a member variable of the axes object.  It will probably turn
> into
> a property so that I can link it with a daspect value.  Also, the values
> should
> be normalized to 1, unless you want to see some interesting
> shrinkage/growth of
> your plot area.Try my branch here:
> https://github.com/WeatherGod/matplotlib/tree/mplot3d/pbaspectAfterbuilding
> that branch, try the following script (shamelessly adapted from some
> Matlab help
> pages for pbaspect and daspect).import matplotlib.pyplot as pltfrom
> mpl_toolkits.mplot3d import Axes3Dimport numpy as npfig = plt.figure()ax =
> fig.gca(projection='3d')x, y = np.mgrid[-2:2:.2, -2:2:.2]z = x *
> np.exp(-x**2 -
> y**2)
> >
> > ax.plot_surface(x, y, z, rstride=1, cstride=1)ax.pbaspect = [1.0, 1.0,
> 0.25]plt.show()While this will squash the z-axis nicely, it does not force
> the
> z-ticks to be pruned, so it gets a little ugly.  However, the axis ticks
> can be
> changed manually.  Also, with some of my other changes coming soon, it
> should be
> possible for the Axes3D object to automatically adjust the spacing of the
> tick
> labels so that it is not impacted by the changes in aspect ratio in the
> perpendicular direction (i.e. - the x and y tick labels are closer to the
> axis
> due to the z-axis scaling).Keep an eye on that branch as I work to improve
> this
> feature, and feel free to contribute to it as well!Ben Root
> >
> >
> >
> ------------------------------------------------------------------------------
> > EditLive Enterprise is the world's most technically advanced content
> > authoring tool. Experience the power of Track Changes, Inline Image
> > Editing and ensure content is compliant with Accessibility Checking.
> > http://p.sf.net/sfu/ephox-dev2dev
> >
> > _______________________________________________
> > Matplotlib-users mailing list
> > Matplotlib-users@...
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >
>
>
> Hello!
>
> I am looking for a tool like pbaspect. The only question is how to
> implement it
> into matplotlib? Do you have a step by step instruction?
>
> Thank you.
> Regards,
> Alexandr
>
>
I guess there has been enough interest in this feature that I probably
should devote some time to correctly implementing it.  I'll see what I can
do!

Ben Root
------------------------------------------------------------------------------
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to