Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 213d37f

Browse files
committed
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.
1 parent dd001ed commit 213d37f

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

examples/text_labels_and_annotations/mathtext_examples.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,7 @@ def doall():
8989
baseline = 1 - i_line * line_axesfrac
9090
baseline_next = baseline - line_axesfrac
9191
fill_color = ['white', 'tab:blue'][i_line % 2]
92-
ax.fill_between([0, 1], [baseline, baseline],
93-
[baseline_next, baseline_next],
94-
color=fill_color, alpha=0.2)
92+
ax.axhspan(baseline, baseline_next, color=fill_color, alpha=0.2)
9593
ax.annotate(f'{title}:',
9694
xy=(0.06, baseline - 0.3 * line_axesfrac),
9795
color=mpl_grey_rgb, weight='bold')

0 commit comments

Comments
 (0)