New axis('equal') command

The revised axis(‘equal’) command is now available on CVS.
Several emails have been posted regarding the proper
functioning. Let me explain what it is designed to do and
why, then we can see if we want to modify (and whether it
works as advertised).

The doc string for axis(‘equal’) is

axis(‘equal’) changes limits of x or y axis such that equal
tick mark increments are equal in size. This makes a circle
look like a circle, for example. This is persistent. For
example, when axis limits are changed after this command,
the scale remains equal

The axis(‘equal’) command works as in matlab. When you give
the command, it will change the data limits of one of the
axes such that the scale is equal on both axes. If you
change the data limits after that with the command axis(),
then it will keep the scales equal, and will resize the
figure. As a result, the order of commands matters (the
same holds in matlab):

plot([1,2,3],[1,2,3])
axis(‘equal’)
axis((1,3,1,3))

will produce a square graph with limits from 1 to 3 on
both axes, while

plot([1,2,3],[1,2,3])
axis((1,3,1,3))
axis(‘equal’)

will create a rectangular plot with axes limits
(0.71620934959349603, 3.283790650406504, 1.0, 3.0)

So far for ‘compatibility’ with matlab. If you want to set
the axes equal, but not change the data limits, all in one
statement, you can do that as follows

plot([1,2,3],[1,2,3])
gca().set_aspect(‘equal’,fixLimits=True)

Regarding the ‘fixLimits’ option, you are telling the
routine to fix the limits, so I think the choice of the
variable name is ok. It may be a good idea to add
‘fixLimits’ as an optional keyword to the pylab interface,
(I would use it a lot for that matter).

Now regarding the history, when using the toolbar in
interactive mode. I think we should modify the history such
that it saves both the data limits and the position. I can
do that (I think); let me know if that is what you want to
do.

The equal scale should be maintained when zooming-in with
the new toolbar.

Things that still need to be fixed: When you resize the
figure in interactive mode by dragging a corner or
expanding to full screen size, the scale of the axes are
not maintained, even if they are set to be equal. I am not
sure where to make this change (where does MPL know that
the figure got resized???). But it would be cool if that
worked as well.

Also, when axis are equal and the axis is shared, and you
change the axis limits such that the size of the subplot
changes, the shared axis size is not changed with it, as I
think it should. I need to fix that too.

I have not tested the current CVS, but hope to find time to
do that soon. Let me know what you think.

Mark