-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
ENH: add two new modes for 'adjustable' option #8700
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
Conversation
The new modes are 'xlim' and 'ylim' - these behave like the 'datalim' option except that only the x or y limits are adjusted, in a deterministic way.
1918f00
to
2fd2dd0
Compare
Can you add the whats_new text to https://github.com/matplotlib/matplotlib/tree/master/doc/users/whats_new ? We do each one in a its own file to avoid needless conflicts. Eventually those will all be rolled up onto the top-level file. |
@tacaswell - thanks for clarifying this, I've done it now |
@tacaswell - is there anything I can do on my side to help with this PR? |
lib/matplotlib/axes/_base.py
Outdated
@@ -438,7 +438,8 @@ def __init__(self, fig, rect, | |||
================ ========================================= | |||
Keyword Description | |||
================ ========================================= | |||
*adjustable* [ 'box' | 'datalim' | 'box-forced'] | |||
*adjustable* [ 'box' | 'datalim' | 'xlim' | 'ylim' | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this has to be one line or have a trailing \
because we still have some home-grown docstring parsing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried on one line but got a PEP8 error in the CI, so adding a \
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modulo minor docstring formatting issue.
There are weird errors on both travis and appveyor:
|
Please hold off on this. I am almost ready to submit a PR that involves quite a few changes related to this. It will be easier to add yours on top of mine than the reverse. |
@efiring - sounds good @tacaswell - are the CI failures likely related to the backslash I added? The CI passed previously before that change. |
Fairly sure the CI stuff is due to a numpy 1.13 bug that is now fixed, restarting the builds to see what happens. |
@efiring - what is the status of the other PR? (which one is it?) I'd really like to get these changes in 2.1 if possible (will rebase once I get the go-ahead) |
Sorry, looks like this is going to miss 2.1 😞 Hopefully 2.2 will be Nov-ish. |
@tacaswell - I can rebase this if you still want to squeeze it in to 2.1? |
I would like to get #8752, or something along those lines, straightened out and merged before adding new options related to aspect-ratio handling. |
@astrofrog is this 2-year-old PR something you'd still like to get in? Feel free to clear the stale flag... |
I'm sorry for the long holdup. #10033, which seems to be the relevant part of #8752 (now closed), is in, so if this is to go forward, now would be a reasonable time for a rebase. @astrofrog, I'm curious: what is the use case motivating this? |
Unfortunately, #14727 is also related, and I expect it to be merged soon, so the rebase here probably should wait for that. |
I'm uncomfortable too. I'm going to close, but @astrofrog, if you want it re-opened for more discussion that would be great! |
PR Summary
This adds two new modes for the
adjustable=
option (inset_aspect
and in the initializer for axes). The new modes are'xlim'
and'ylim'
- these behave like the 'datalim' option except that only the x or y limits are adjusted, in a deterministic way. The changes are backward-compatible. It looked like there were no (?) tests foradjustable='datalim'
, so I've covered that in the test I added.Question: I need to add an entry to 'what's new', but it looks like
doc/users/whats_new.rst
refers to 2.0 not 2.1?PR Checklist
Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way(I wasn't sure if I was supposed to tick the above, or the reviewers, maybe this could be made clearer?)
cc @tacaswell - as discussed on Gitter