Michael Droettboom wrote:
> You can call
> 
>    ax.apply_aspect()
> 
> to do the aspect ratio calculations -- seems to work for me here with 
> your example.
> 
> The aspect ratio code has always felt like a bit of a black art to me 
> (it's a seemingly "necessarily complex" piece of code).  Maybe someone 
> else can answer -- is there a reason not to call apply_aspect() from 
> set_aspect() besides a little extra computation?  It obviously will 
> still have to be called from draw (in case the figure size changes), but 
> does it hurt to do it one extra time?

Mike, Mark,

I answered this a minute ago before seeing the present set of messages, 
and without working through it carefully.

Now I see that, indeed, the simple default version of the call (no 
arguments) is identical to the version in the draw method.

It is possible that it would not actually hurt to call it in set_aspect, 
but I would need to look at that quite carefully, which I can't do right 
now.  Maybe this evening or this weekend at the latest.  And, the answer 
may be different for svn versus the present release; I will consider 
only svn.

I agree entirely that the aspect ratio code is complex, and painful to 
work with.  It took a long time to get it to its present state--make it 
do most things reasonably; a case is found where it doesn't work; fix 
that; another problem pops up; fix that; and on and on--but throughout 
there has been a sense that surely there must be a better way!

The torture test for the aspect ratio code is making a plot (or worse, a 
set of subplots with shared axes) and then using the toolbar box-select 
and the pan/zoom control and the display window corner to manipulate it 
every which way.  Then call set_aspect with a different setting and make 
sure it redraws sensibly, and do it all over again.

Eric

> 
> Cheers,
> Mike
> 
> Mark Bakker wrote:
>> Hello -
>>
>> As reported in an earlier post, when setting aspect ratio, the axis 
>> limits don't get updated correctly it seems. Or maybe I have to make 
>> another function call. Very easy example:
>>
>> from pylab import *
>> ax = subplot(211)
>> plot([1,2,3])
>> ax.set_aspect('equal',adjustable='datalim')
>> print ax.get_xlim()  # Gives you (0.0, 2.0), which is incorrect, as the 
>> data limits have been stretched.
>> draw()
>> print ax.get_xlim() # Gives (-1.8243394308943093, 3.8243394308943093) or 
>> something like it, which is correct
>>
>> I don't want to call draw, so is there some other function I can call to 
>> update the axis limits? Should that function be called automatically 
>> from set_aspect ?
>>
>> I am using mpl 0.92.1. Thanks, Mark
> 


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to