> different behaviour when changing the order of
> `axis("equal")` and `axis([-0.35,2.1,-0.2,1.25])` persists.)
It is not surprising that the order makes a difference.
To be honest, from a user perspective such effects
are very problematic and I would usually considered as a bug.
Together with Martin Richter I had a closer look at this:
a) pylab.py, axis(...):
I think, that the command
` axis([0.5,1.0,-2.0,5.0])` should,
whenever `ax.get_aspect() == 'equal'`,
recompute the aspect.
This could be achieved by calling
before the corresponding `draw_if_interactive()`
and the set_aspect routine in axes.py would read at the beginning:
b) For axes.py, set_aspect, it seems better to us
to restore the originalPosition:
else: # Change limits on axes
#l,b,w,h = self.get_position() # Keep size of subplot
# ---> # restore changes which could have come from
# ---> # a previous call axes("scaled"), i.e. fixLimits=True:
l,b,w,h = self._originalPosition
self.set_position( (l,b,w,h) )
axW = w * figW; axH = h * figH
a) should ensure that it does not matter when a range is set
b) should ensure that after an `axis("scaled")`
an `axis("equal")` gives the same result
as if the `axis("scaled")` was not given before.
I am not sure if the above has any unwanted side-effects.
At least it gets rid of a couple of the ordering
correcting for the aspect ratio, either the data limits, window
limits, or both have to change. The default is to change the data
limits, but you can control this by calling
This is the function that axis('equal') calls, and by using it
directly you can tweak some of the default behaviors. See the
docstring for set_aspect (in CVS) for more information.
I don't like the name `fixLimits` to much, because
it sounds as if something has to be fixed (but nothing is broken, IMHO).
What about `fixedLimits`?
(Sorry if I am showing off my English deficiencies here ...)
While at this: I also don't like `autoscale_on` very much.
I think that `autoscale` (being True or False) would be enough.
And one more (just to complicate matters even more):
At the moment there is only autoscaling for x and y
at the same time. Gnuplot, for example, allows
to specify the xrange or yrange separately and the
other range is autoscaled.
I am mentionining this, because it might be a useful feature.
(However, it might make the coding of
the autoscaling even more involved...).
This is fairly new functionality so let us know if this works for you.
It might be a good idea for someone to start a wiki entry on the
various issues of axes aspect ratio.
I hope that everything can be done easily just by using
`axis(...)`. A few examples would be very good for the
wiki (or the demo). I could provide these (after
I am back from a conference next week...).
On Fri, 2 Sep 2005, John Hunter wrote: