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

Skip to content

Serious problems on the axes documentation #6055

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
kawing-chiu opened this issue Feb 24, 2016 · 8 comments · Fixed by #14989
Closed

Serious problems on the axes documentation #6055

kawing-chiu opened this issue Feb 24, 2016 · 8 comments · Fixed by #14989
Milestone

Comments

@kawing-chiu
Copy link

I've found two problems in the documentation of axes:

  1. In the docstring of set_xlim() and set_ylim(), it read: "Set the data limits for the xaxis". It should be view limits instead, which is very confusing.
  2. In the docstring of autoscale_view(), it should be mentioned that, if set_xlim() or set_ylim() has been called on the same axes before, autoscale_view() will not work (because _autoscaleXon would have been set to False by the above two functions) and autoscale() should be used instead.
@tacaswell
Copy link
Member

Pull requests for documentation are always welcome!

@kawing-chiu
Copy link
Author

OK, I'll see if I have time to make a PR in the next weekend. So is my understanding above on the set_xlim() and autosacle_view() methods correct?

@tacaswell tacaswell added this to the 2.0.1 (next bug fix release) milestone Mar 1, 2016
@tacaswell
Copy link
Member

  1. is clearly correct. I am not sure about the distinction between 'data limits' and 'view limits', they map to the same concept in my head. You are making a distinction between the limits of the data passed in ([min(x), max(x)]) and the limits of the data shown on the graph? If that is the case I do not see a problem with making the docstring clearer / more precise.

@kawing-chiu
Copy link
Author

Yes, this is what I mean, and I think this distinction can also be seen in the code? Like, ax.dataLim and ax.viewLim. And set_xlim() changes ax.viewLim.

@tacaswell
Copy link
Member

Yup, we do make that distinction in the code 🐑 . Thanks for pointing that out!

@QuLogic QuLogic modified the milestones: 2.0.1 (next bug fix release), 2.0.2 (next bug fix release) May 3, 2017
@tacaswell tacaswell modified the milestones: 2.1.1 (next bug fix release), 2.2 (next feature release) Oct 9, 2017
@sameshl
Copy link
Contributor

sameshl commented Aug 5, 2019

@tacaswell I would like to work on this. So, if I understand correctly I am supposed to make changes in docstrings set_xlim() and set_ylim() such that Set the data limits for the xaxis --> View the data limits for the xaxis

Is that it?

@ImportanceOfBeingErnest
Copy link
Member

Note quite.

For 1.: There is a distinction between data limits and view limits. The data limits are the bounding box of all the data in the axes, but usually the axes leave some margin around the data, so set_{x,y}lim() set the view limits of the axes. Probably this is just about

"Set the view limits for the xaxis."

For 2. This is about the fact that ax.autoscale_view() does not change the view limits if they have been set via set_{x,y}lim(). So the request here is to let the documentation state something like

"The the view limits of the axes are fixed, e.g. via set_xlim, they will not be changed by autoscale_view(). See autoscale() for an alternative.

or similar.

@sameshl
Copy link
Contributor

sameshl commented Aug 5, 2019

Regarding 1:
This has already been implemented in that latest matplotlib release as the changes can be seen at set_xlim and set_ylim

timhoffm pushed a commit that referenced this issue Aug 9, 2019
* DOC:Update axes documentation

Add info about the fact no change in view limits with `autoscale_view()` if axes already
set, e.g with `set_xlim()`

closes #6055

* fix formatting issues

* update note

set_xlim ---> `set_xlim`
@QuLogic QuLogic modified the milestones: needs sorting, v3.2.0 Aug 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants