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? 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 -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA ------------------------------------------------------------------------- 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