A matlab-like 'axis equal' command

Hello - I wrote a small function that scales the axes so

    > that the true scale (e.g. the coordinates per inch) are the
    > same along each axis. This is useful when you contour
    > spatial data where the x and y axes are in meters, for
    > example. It is equivalent to the 'axis equal' command in
    > matlab. Except that once given that command in matlab it is
    > persistent. Here you have to push the button every time you
    > changed the figure window or zoom.

Hey Mark,

Did you know there is already an "equal" option to the axis command.
If it doesn't work right, could you fix it and send me a patch?

    > I added the function to the toolbar2 class and added a
    > button to the toolbar. For the Tk backend this works great.
    > And I don't think it is back-end dependent, but then again,
    > what do I know.

    > Any chance that such a button on the toolbar can be added to
    > the official release? Or are there better ways to do this?

This kind of button is useful to many but not others, and is a perfect
candidate for a modular toolbar. We've talked in the past about
supporting customized toolbars, with a contrib module for user defined
tool functions. But this has stalled in part because modifying the
toolbar across many GUIs is a pain. One solution would be to use
matplotlib buttons in a GUI neutral toolbar -- then customizing it
would be trivial and would work for free across backends.

Perhaps you should post a patch or code so others could test your
button and see if they like it enough to put it on the standard
toolbar until we get support for custom, extensible toolbars.

JDH

John -

The current option for 'axis(‘equal’) only sets the coordinate range the same on each axis, correct?
What I want is to have the lengths of the axes scaled according to the min/max values along the x and y axes.
That is important when you contour spatial data, for example.
That’s the button I made.

I understand the hassle of adding a button that works on all back-ends.
I’ll try to post my button for the TK back-end and we’ll take it from there.

Mark

···

On 7/6/05, John Hunter <jdhunter@…83…4…> wrote:

> Hello - I wrote a small function that scales the axes so
> that the true scale (

e.g. the coordinates per inch) are the
> same along each axis. This is useful when you contour
> spatial data where the x and y axes are in meters, for
> example. It is equivalent to the ‘axis equal’ command in

> matlab.  Except that once given that command in matlab it is
> persistent. Here you have to push the button every time you
> changed the figure window or zoom.

Hey Mark,

Did you know there is already an “equal” option to the axis command.
If it doesn’t work right, could you fix it and send me a patch?

> I added the function to the toolbar2 class and added a

> button to the toolbar.  For the Tk backend this works great.
> And I don't think it is back-end dependent, but then again,
> what do I know.

> Any chance that such a button on the toolbar can be added to

> the official release?  Or are there better ways to do this?

This kind of button is useful to many but not others, and is a perfect
candidate for a modular toolbar. We’ve talked in the past about

supporting customized toolbars, with a contrib module for user defined
tool functions. But this has stalled in part because modifying the
toolbar across many GUIs is a pain. One solution would be to use
matplotlib buttons in a GUI neutral toolbar – then customizing it

would be trivial and would work for free across backends.

Perhaps you should post a patch or code so others could test your
button and see if they like it enough to put it on the standard
toolbar until we get support for custom, extensible toolbars.

JDH