Skip to content

autoscale context manager #5510

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
anntzer opened this issue Nov 18, 2015 · 7 comments
Closed

autoscale context manager #5510

anntzer opened this issue Nov 18, 2015 · 7 comments

Comments

@anntzer
Copy link
Contributor

anntzer commented Nov 18, 2015

Currently, {plt,Axes}.autoscale returns None. Any thoughts on turning it into a context manager?

@mdboom
Copy link
Member

mdboom commented Nov 18, 2015

I have no objections from an API point of view.

@tacaswell
Copy link
Member

How can that be done in a back-compatible way?

@mdboom
Copy link
Member

mdboom commented Nov 18, 2015

If the context manager takes effect in __init__ rather than __enter__ it will ways take effect, even if the caller does nothing with it (the current API). The only difference would be to have the effect reverted in __exit__.

@tacaswell
Copy link
Member

ah, cute!

@mdboom
Copy link
Member

mdboom commented Nov 19, 2015

@anntzer: Were you offering to make a pull request?

@anntzer
Copy link
Contributor Author

anntzer commented Nov 19, 2015

Perhaps in a few days.

anntzer added a commit to anntzer/matplotlib that referenced this issue Nov 21, 2015
See matplotlib#5510.

Also clarify a bit the implementation of autoscale, and fix an issue about the
lack of effect of set_autoscalez_on for 3D axes, which was previously visible
by running::

    from pylab import *
    from mpl_toolkits import mplot3d

    gcf().add_subplot(111, projection="3d")
    plot([0, 1], [0, 1], [0, 1])
    gca().set_autoscalex_on(False)
    gca().set_autoscalez_on(False) # has no effect
    plot([2, 3], [2, 3], [2, 3])
    show()
anntzer added a commit to anntzer/matplotlib that referenced this issue Nov 23, 2015
See matplotlib#5510.

Also clarify a bit the implementation of autoscale, and fix an issue about the
lack of effect of set_autoscalez_on for 3D axes, which was previously visible
by running::

    from pylab import *
    from mpl_toolkits import mplot3d

    gcf().add_subplot(111, projection="3d")
    plot([0, 1], [0, 1], [0, 1])
    gca().set_autoscalex_on(False)
    gca().set_autoscalez_on(False) # has no effect
    plot([2, 3], [2, 3], [2, 3])
    show()
@anntzer
Copy link
Contributor Author

anntzer commented Apr 16, 2017

Closing due to #5538 (comment) (not realistically possible for now).

@anntzer anntzer closed this as completed Apr 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants