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: ax[1].get_ylim() (-0.61935483870967734, 0.61935483870967734) and doing a set_ylim doesn't have any effect. This seems to be caused by the set_aspect('equal'), since removing it results in plots with the correct limits -- but aspect that is not quite equal. It is affected by the figsize parameter in the call to subplots. It seems I can get the correct y limits and aspect if I keep the set_aspect('equal') and fiddle with the figsize. But that certainly doesn't seem to be a desirable behavior. Ideally, the set_ylim (or set_xlim) would be respected as well as the apect ratio and extra blank space around the figure would be added as needed to fit the figsize. By the way, using no figsize argument to subplots results in y limits even smaller than the data limits. Also, this problem does not occur for single (non-stacked) plots and the use of subplots_adjust also does not seem to affect the problem. I'm using matplotlib 1.2.0 I did notice that this issue is similar to that discussed in this thread: http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg05783.html Regards, Jon -- ______________________________________________________________ Jonathan D. Slavin Harvard-Smithsonian CfA jsla...@cfa.harvard.edu 60 Garden Street, MS 83 phone: (617) 496-7981 Cambridge, MA 02138-1516 cell: (781) 363-0035 USA ______________________________________________________________ ------------------------------------------------------------------------------ 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users