Skip to content

Deprecate FancyBboxPatch(..., boxstyle="custom", bbox_transmuter=...) #17749

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
Jun 28, 2020

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Jun 24, 2020

One can directly pass the custom bbox as the boxstyle argument,
instead of setting boxstyle to "custom" and passing it as the
(otherwise unused) bbox_transmuter argument. This is consistent with
arrowstyles and connectionstyles.

The old API appears to date back to very early boxstyle API designs
(pre-73f34bf), where arbitrary callables were not directly supported.

In text.py one can just not pop bbox_transmuter from rectprops but
just pass the dict as is to FancyBboxPatch, triggering the deprecation
if and only if the key is present.

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@anntzer anntzer added this to the v3.4.0 milestone Jun 24, 2020
@QuLogic
Copy link
Member

QuLogic commented Jun 25, 2020

The docs for .set_boxstyle could maybe be updated to mention this is supported also.

@anntzer anntzer force-pushed the custombboxtransmuter branch from b44be42 to 0c907b6 Compare June 25, 2020 10:24
@anntzer
Copy link
Contributor Author

anntzer commented Jun 25, 2020

I copied the docstring from the constructor. Technically the docstring is wrong because BoxStyle.Foo is not an instance of BoxStyle (BoxStyle effectively just serves as a namespace and a factory function for boxstyles, but not as a base class), but let's leave fixing that to another time...

@anntzer anntzer force-pushed the custombboxtransmuter branch from 0c907b6 to 9a1cf9a Compare June 25, 2020 22:40
@tacaswell
Copy link
Member

Do we need to document that you can pass an arbitrary callable with the right signature?

@anntzer
Copy link
Contributor Author

anntzer commented Jun 26, 2020

We do, but the situation is currently the same for arrow/connectionstyle, and we also have the isinstance(..., BoxStyle) vs isinstance(..., BoxStyle._Base) confusion, so let's defer documentation to a later PR.

anntzer and others added 2 commits June 27, 2020 23:41
One can directly pass the custom bbox as the `boxstyle` argument,
instead of setting `boxstyle` to "custom" and passing it as the
(otherwise unused) `bbox_transmuter` argument.  This is consistent with
arrowstyles and connectionstyles.

The old API appears to date back to very early boxstyle API designs
(pre-73f34bf), where arbitrary callables were not directly supported.

In text.py one can just not pop `bbox_transmuter` from rectprops but
just pass the dict as is to FancyBboxPatch, triggering the deprecation
if and only if the key is present.
Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
@tacaswell tacaswell force-pushed the custombboxtransmuter branch from f69fdeb to d50234c Compare June 28, 2020 03:42
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.

I did the rebase, anyone can merge on green.

@timhoffm timhoffm merged commit 56d4f69 into matplotlib:master Jun 28, 2020
@anntzer anntzer deleted the custombboxtransmuter branch June 28, 2020 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants