Hi Eric,

> On 8 Apr 2015, at  11:02 AM, Eric Firing <efir...@hawaii.edu> wrote:
> 
> I'm the guilty party for most of how set_aspect works.  I developed it a 
> long time ago. Yes, there was a reason--still is, I'm 99% sure--but I 
> don't remember everything, and don't want to take the time now to 
> reconstruct the whole rationale.  When I was developing the behavior, I 
> was paying a lot of attention to what happens under various scenarios of 
> resizing and reshaping the window, and turning options on and off. 
> There are some basic conflicts that arise when shared axes are combined 
> with fixed aspect ratios, autoscaling, and gui-driven reshaping. 
> Sometimes 'box-forced' does what people want, maybe more often than not; 
> but I'm pretty sure it can lead to trouble, which is the reason it is 
> not the default.

OK, first my apologies:

import matplotlib.pyplot as plt
fig, axes = plt.subplots(nrows=2)
axes[0].set_aspect(1.)
axes[0].plot(np.arange(10),np.arange(10))
axes[0].set_ylim([0,24])
axes[0].set_xlim([0,12])
axes[1].plot(np.arange(10),np.arange(10)*2.)
plt.show()

Works as I'd expect.  axes[0] gets shrunk in the x dimension to make the aspect 
ratio 1.

However:

import matplotlib.pyplot as plt
fig, axes = plt.subplots(nrows=2,sharex=True)
axes[0].set_aspect(1.)
axes[0].plot(np.arange(10),np.arange(10))
axes[0].set_ylim([0,24])
axes[0].set_xlim([0,12])
axes[1].plot(np.arange(10),np.arange(10)*2.)
plt.show()

does not work as I'd expect.  axes[0]'s ylim gets changed so that the line is 
no longer viewable (= 10-14).  In my opinion, the two calls should work the 
same, except in the second case, axes[1]'s xlim should be 0-12.  

Even worse, if I use the same aspect ratio in axes[1], they *both* do not show 
all the data: 

axes[0].set_aspect(1.)

It appears here that with sharex=True the shape of the axis no longer becomes 
mutable when set_aspect() is used, whereas if sharex=False set_aspect() can 
change the axis shape. I don't see any reason for sharex to foist this 
behaviour onto set_aspect().  

I guess the workaround is don't use sharex=True, but I actually think this is a 
bug.  

Thanks,   Jody

--
Jody Klymak    
http://web.uvic.ca/~jklymak/






------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to