Skip to content
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

Deprecate 'prune' kwarg to MaxNLocator #25191

Closed
wants to merge 1 commit into from

Conversation

dstansby
Copy link
Member

PR Summary

We do not seem to use prune in any tests or examples, so it seems resonable to deprecate because:

  • There's not loads of code to support this, but it's still a little bit of bloat on the already complex MaxNLocator
  • It's easy enough for users to replicate the behaviour by simple indexing after the tick values are returned
  • prune is not particularly new, dating back 14 years: 0c79ba3

PR Checklist

Documentation and Tests

  • Has pytest style unit tests (and pytest passes)
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • New plotting related features are documented with examples.

Release Notes

  • New features are marked with a .. versionadded:: directive in the docstring and documented in doc/users/next_whats_new/
  • API changes are marked with a .. versionchanged:: directive in the docstring and documented in doc/api/next_api_changes/
  • Release notes conform with instructions in next_whats_new/README.rst or next_api_changes/README.rst

@dstansby dstansby added this to the v3.8.0 milestone Feb 10, 2023
lib/matplotlib/ticker.py Outdated Show resolved Hide resolved
Comment on lines +2052 to +2054
"3.8", message="The 'prune' keyword argument is deprecated, "
"and will be removed in Matplotlib %(removal)s. Tick pruning "
"should be done manually after the ticks have been generated."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last sentence should be passed to addendum instead of overriding message.

def __init__(self, nbins=10, steps=None,
trim=True,
integer=False,
symmetric=False,
prune=None):
# trim argument has no effect. It has been left for API compatibility
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should keep this comment, or also look into deprecating it as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make steps keyword only?

@@ -0,0 +1,6 @@
Automatically pruning ticks in ``MaxNLocator``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The ``prune`` keyword argument to both `matplotlib.ticker.MaxNLocator` and
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The ``prune`` keyword argument to both `matplotlib.ticker.MaxNLocator` and
The *prune* keyword argument to both `matplotlib.ticker.MaxNLocator` and

@@ -2044,8 +2038,6 @@ def set_params(self, **kwargs):
see `.MaxNLocator`
symmetric : bool, optional
see `.MaxNLocator`
prune : {'lower', 'upper', 'both', None}, optional
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not remove yet? Add deprecation notice instead?

@dstansby
Copy link
Member Author

It's been too long since I looked at this, and the rebase isn't simple, so I'm going to close. If someone really thinks we should get this in please shout, otherwise I won't pursue it.

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.

None yet

6 participants