On 2013-03-20 14:25, Eric Firing wrote:
> > On 2013/03/20 8:57 AM, Jonathan Slavin wrote:
>> >> Hi all,
>> >>
>> >> I've run across a minor but annoying bug. It can be
demonstrated pretty
>> >> simply:
>> >>
>> >> fig, ax = plt.subplots(2,1,sharex=True,figsize=(7.,7.))
>> >> fig.subplots_adjust(hspace=0.0)
>> >> x = 4.25*(np.arange(6.) - 2.5)/10.
>> >> y = 0.6*x/max(x)
>> >> ax[0].plot(x,y)
>> >> ax[0].set_xlim(-1.2,1.2)
>> >> ax[0].set_aspect('equal')
>> >> ax[1].plot(x,y)
>> >> ax[0].set_ylim(-0.6,0.6)
>> >> ax[1].set_ylim(-0.6,0.6)
>> >> ax[1].set_aspect('equal')
>> >> plt.show()
>> >>
>> >> The problem is that the y limits on the two plots are slightly
different
>> >> from those set:
> >
> > I think the problem is that you are trying to specify too many
things:
> > you are specifying the box dimensions when you make the axes,
then you
> > are specifying xlim, and then you are specifying ylim, but then
you are
> > asking for a 1:1 aspect ratio. Something has to give! The
aspect ratio
> > handling is designed to provide the specified aspect ratio under
a wide
> > range of circumstances, including zooming and panning, and to do
that,
> > it has to be able to change something. You can choose to let the box
> > dimensions be changeable, or the data limits.
If I understand right, though, in this case what should give is the
spacing around the axes but inside the figure (as suggested in the
original post). You should be able to fix the aspect ratio of the
*axes* and also the dimensions of the *figure*, and let the slack be
taken up by blank space around the axes. It would still be possible
for the dimensions of the axes box to change, just not their aspect
ratio (i.e., zooming in on an oblong region would just result in a lot
of blank space).
-- Brendan Barnwell "Do not follow where the path may lead. Go,
instead, where there is no path, and leave a trail." --author unknown
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users