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

doc: mathtext example: use axhspan() instead of fill_between() for backdrop rectangle shading #23063

Merged
merged 1 commit into from May 18, 2022

Conversation

megies
Copy link
Contributor

@megies megies commented May 18, 2022

PR Summary

This changes the "mathtext example" code snippet to not use ax.fill_between() to place rectangular background shades but rather use ax.axhspan() instead.

https://matplotlib.org/devdocs/gallery/text_labels_and_annotations/mathtext_examples.html

fill_between() isn't the right thing to use here, I think. It might do the same thing (as long as the plot isn't interacted with / zoomed out), but it feels real clunky and I think it should not be encouraged to be used like that in this user facing example. I only encountered this because this plot actually was showing up as a usage example on the plt.fill_between() API docs page (older version, 3.1.1, changed in current docs it seems) and I found this real odd.

Can rebase if it should go in a different branch.

From 3.1.1 docs screenshot:

Screenshot from 2022-05-18 11-26-51

PR Checklist

Tests and Styling

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (install flake8-docstrings and run flake8 --docstring-convention=all).

Documentation

  • New features are documented, with examples if plot related.
  • New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).

fill_between isn't the right thing to use here. It might do the same
thing (as long as the plot isn't interacted with / zoomed out), but it
feels real clunky and should not be encouraged to use here in a user
facing example. I only encountered this because this plot was showing up
as a usage example on the plt.fill_between() API docs (older version)
and I found this real odd.
@jklymak jklymak added this to the v3.6.0 milestone May 18, 2022
@timhoffm timhoffm merged commit e1bdb3b into matplotlib:main May 18, 2022
@timhoffm
Copy link
Member

Thanks!

@megies megies deleted the doc_mathtext_example_axhspan branch May 18, 2022 12:27
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

3 participants