From 213d37f6ef222b54f340912e5db06fbe927bd45a Mon Sep 17 00:00:00 2001 From: Tobias Megies Date: Wed, 18 May 2022 11:21:48 +0200 Subject: [PATCH] doc: mathtext example use axhspan instead of fill_between 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. --- examples/text_labels_and_annotations/mathtext_examples.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/examples/text_labels_and_annotations/mathtext_examples.py b/examples/text_labels_and_annotations/mathtext_examples.py index b762ace5aa4a..838b68bb2ca2 100644 --- a/examples/text_labels_and_annotations/mathtext_examples.py +++ b/examples/text_labels_and_annotations/mathtext_examples.py @@ -89,9 +89,7 @@ def doall(): baseline = 1 - i_line * line_axesfrac baseline_next = baseline - line_axesfrac fill_color = ['white', 'tab:blue'][i_line % 2] - ax.fill_between([0, 1], [baseline, baseline], - [baseline_next, baseline_next], - color=fill_color, alpha=0.2) + ax.axhspan(baseline, baseline_next, color=fill_color, alpha=0.2) ax.annotate(f'{title}:', xy=(0.06, baseline - 0.3 * line_axesfrac), color=mpl_grey_rgb, weight='bold')