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

Mark,

In the present design, there is quite a bit that happens only when 
draw() is invoked; in particular, the apply_aspect() method is called 
when an axes is drawn.  set_aspect merely sets the parameters that 
apply_aspect will use.  It would not make sense for set_aspect to call 
apply_aspect.

I have not thought this through, but in place of the call to draw() you 
could try making the same call that the Axes.draw() method does:

  ax.apply_aspect(ax.get_position(True))

Eric


-------------------------------------------------------------------------
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