Skip to content

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

Closed
wants to merge 4 commits into from

Conversation

astrofrog
Copy link
Contributor

@astrofrog astrofrog commented Jun 1, 2017

PR Summary

This adds two new modes for the adjustable= option (in set_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 for adjustable='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

  • Has Pytest style unit tests
  • Code is PEP 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/whats_new.rst if major new feature
  • 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

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.
@astrofrog astrofrog force-pushed the adjustable-xlim-ylim branch from 1918f00 to 2fd2dd0 Compare June 1, 2017 15:25
@tacaswell
Copy link
Member

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.

@astrofrog
Copy link
Contributor Author

@tacaswell - thanks for clarifying this, I've done it now

@tacaswell tacaswell added this to the 2.1 (next point release) milestone Jun 1, 2017
@astrofrog
Copy link
Contributor Author

@tacaswell - is there anything I can do on my side to help with this PR?

@@ -438,7 +438,8 @@ def __init__(self, fig, rect,
================ =========================================
Keyword Description
================ =========================================
*adjustable* [ 'box' | 'datalim' | 'box-forced']
*adjustable* [ 'box' | 'datalim' | 'xlim' | 'ylim' |
Copy link
Member

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.

Copy link
Contributor Author

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 \

Copy link
Member

@tacaswell tacaswell left a 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.

@tacaswell
Copy link
Member

There are weird errors on both travis and appveyor:

.......ssss.....ssss..s..s....s..ss...s...ssssss..s....s..s.s...s..sss.s..s.ssss..ssss..ssss..ssss..ssss.s....s.ss.s.....sss.ss....s.sss.s...s.ss.s.s.ss..s.sss.ss..ssss.s....s.sss...s...ss..sss.s..s...ssss.s.s.s..s...s..s.................s.......s.s..........s..........s.....s....s.s..s.s..ss.s.s.ss.s..sss..s..s.sss..s...s..sss.s..s.s.ss....s.....ss..................................................................................................................................s.....s.........................................s............sxsCoverage.py warning: No data was collected. (no-data-collected)
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "C:\Miniconda-x64\envs\test-environment\lib\site-packages\_pytest\main.py", line 105, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "C:\Miniconda-x64\envs\test-environment\lib\site-packages\_pytest\main.py", line 141, in _main
INTERNALERROR>     config.hook.pytest_runtestloop(session=session)
INTERNALERROR>   File "C:\Miniconda-x64\envs\test-environment\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 745, in __call__
INTERNALERROR>     return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
INTERNALERROR>   File "C:\Miniconda-x64\envs\test-environment\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 339, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "C:\Miniconda-x64\envs\test-environment\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 334, in <lambda>
INTERNALERROR>     _MultiCall(methods, kwargs, hook.spec_opts).execute()
INTERNALERROR>   File "C:\Miniconda-x64\envs\test-environment\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 613, in execute
INTERNALERROR>     return _wrapped_call(hook_impl.function(*args), self.execute)
INTERNALERROR>   File "C:\Miniconda-x64\envs\test-environment\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 250, in _wrapped_call
INTERNALERROR>     wrap_controller.send(call_outcome)
INTERNALERROR>   File "C:\Miniconda-x64\envs\test-environment\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 280, in get_result
INTERNALERROR>     _reraise(*ex)  # noqa
INTERNALERROR>   File "C:\Miniconda-x64\envs\test-environment\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 265, in __init__
INTERNALERROR>     self.result = func()
INTERNALERROR>   File "C:\Miniconda-x64\envs\test-environment\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 614, in execute
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "C:\Miniconda-x64\envs\test-environment\lib\site-packages\xdist\dsession.py", line 539, in pytest_runtestloop
INTERNALERROR>     self.loop_once()
INTERNALERROR>   File "C:\Miniconda-x64\envs\test-environment\lib\site-packages\xdist\dsession.py", line 558, in loop_once
INTERNALERROR>     call(**kwargs)
INTERNALERROR>   File "C:\Miniconda-x64\envs\test-environment\lib\site-packages\xdist\dsession.py", line 664, in slave_testreport
INTERNALERROR>     self.sched.mark_test_complete(node, rep.item_index, rep.duration)
INTERNALERROR>   File "C:\Miniconda-x64\envs\test-environment\lib\site-packages\xdist\dsession.py", line 280, in mark_test_complete
INTERNALERROR>     self.node2pending[node].remove(item_index)
INTERNALERROR> ValueError: list.remove(x): x not in list

@efiring
Copy link
Member

efiring commented Jun 12, 2017

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.

@astrofrog
Copy link
Contributor Author

@efiring - sounds good

@tacaswell - are the CI failures likely related to the backslash I added? The CI passed previously before that change.

@dstansby
Copy link
Member

Fairly sure the CI stuff is due to a numpy 1.13 bug that is now fixed, restarting the builds to see what happens.

@astrofrog
Copy link
Contributor Author

@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)

@tacaswell
Copy link
Member

Sorry, looks like this is going to miss 2.1 😞

Hopefully 2.2 will be Nov-ish.

@tacaswell tacaswell modified the milestones: 2.2 (next next feature release), 2.1 (next point release) Sep 1, 2017
@astrofrog
Copy link
Contributor Author

@tacaswell - I can rebase this if you still want to squeeze it in to 2.1?

@efiring
Copy link
Member

efiring commented Sep 1, 2017

I would like to get #8752, or something along those lines, straightened out and merged before adding new options related to aspect-ratio handling.

@jklymak
Copy link
Member

jklymak commented Jul 16, 2019

@astrofrog is this 2-year-old PR something you'd still like to get in? Feel free to clear the stale flag...

@efiring
Copy link
Member

efiring commented Jul 16, 2019

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?

@efiring
Copy link
Member

efiring commented Jul 17, 2019

Unfortunately, #14727 is also related, and I expect it to be merged soon, so the rebase here probably should wait for that.
I have to admit that I'm also a little uncomfortable with making the already complicated datalim code even more complicated by adding these two variations.

@jklymak
Copy link
Member

jklymak commented Jul 24, 2019

I'm uncomfortable too. I'm going to close, but @astrofrog, if you want it re-opened for more discussion that would be great!

@jklymak jklymak closed this Jul 24, 2019
@story645 story645 removed this from the future releases milestone Oct 6, 2022
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.

6 participants