Thanks to visit codestin.com
Credit goes to github.com

Skip to content

DOC: fix autoscale docstring #18671

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

Merged
merged 2 commits into from
Oct 11, 2020
Merged

Conversation

jklymak
Copy link
Member

@jklymak jklymak commented Oct 6, 2020

PR Summary

The previous versions made it sound like this would be applied per plot command, whereas the autoscale_on really is applied at draw time.

Closes #18662

PR Checklist

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (run flake8 on changed files to check).
  • New features are documented, with examples if plot related.
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • Conforms to Matplotlib style conventions (install flake8-docstrings and pydocstyle<4 and run flake8 --docstring-convention=all).
  • New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).

@jklymak
Copy link
Member Author

jklymak commented Oct 6, 2020

@QuLogic
Copy link
Member

QuLogic commented Oct 6, 2020

This only changed because it was made lazy; maybe we want it to re-scale when disabling it?

@jklymak
Copy link
Member Author

jklymak commented Oct 6, 2020

Oh, hmmm. If we do:

import matplotlib.pyplot as plt
import numpy as np

fig, axes = plt.subplots(2, 1, sharex=True)

for i in range(2):
    ax = axes[i]
    ax.plot(np.random.randn(1000), lw=1)
    #fig.canvas.draw()
    l, = ax.plot([500, 500], ax.get_ylim(), 'k')
    # ax.autoscale_view()
    ax.set_autoscaley_on(False)

ax.set_ylim(-3, 3)
plt.show()

Then the limits are correct. So I think get_ylim calls the autolim machinery.

I don't think that we want to have set_autoscale_on do anything other than tell `auto

@timhoffm timhoffm merged commit 7ce2f67 into matplotlib:master Oct 11, 2020
@timhoffm
Copy link
Member

@dopplershift @jklymak If you think that there is an issue with the auto scaling behavior, please open a separate issue\PR. I've merged this as a doc improvement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistent setting of axis limits with autoscale=False
4 participants