doc: mathtext example: use axhspan() instead of fill_between() for backdrop rectangle shading #23063
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Summary
This changes the "mathtext example" code snippet to not use
ax.fill_between()
to place rectangular background shades but rather useax.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 theplt.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:
PR Checklist
Tests and Styling
pytest
passes).flake8-docstrings
and runflake8 --docstring-convention=all
).Documentation
doc/users/next_whats_new/
(follow instructions in README.rst there).doc/api/next_api_changes/
(follow instructions in README.rst there).