8000 MNT: fixes from code review. · matplotlib/matplotlib@50c397a · GitHub
[go: up one dir, main page]

Skip to content

Commit 50c397a

Browse files
tacaswelltimhoffm
andauthored
MNT: fixes from code review.
Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
1 parent 03aa5e3 commit 50c397a

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7201,7 +7201,7 @@ def stairs(self, values, edges=None, *,
72017201
72027202
Passing both ``fill=True` and ``baseline=None`` will likely result in
72037203
undesired filling as the first and last points will be connected
7204-
with a straight line with the fill between and the stairs.
7204+
with a straight line with the fill between the line and the stairs.
72057205
72067206
72077207
Returns
@@ -7244,6 +7244,7 @@ def stairs(self, values, edges=None, *,
72447244
if baseline is None and fill:
72457245
_api.warn_external(
72467246
f"Both {baseline=} and {fill=} have been passed. "
7247+
"baseline=None is only intended for unfilled stair plots. "
72477248
"Because baseline in None, the Path used to draw the stairs will "
72487249
"not be closed, thus because fill is True the polygon will be closed "
72497250
"by drawing an (unstroked) edge from the first to last point. It is "

lib/matplotlib/tests/test_axes.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2344,18 +2344,13 @@ def test_hist_zorder(histtype, zorder):
23442344

23452345
def test_stairs_no_baseline_fill_warns():
23462346
fig, ax = plt.subplots()
2347-
baseline = None
2348-
fill = True
2349-
warn_match = (
2350-
"Because baseline in None, the Path used to draw the stairs will "
2351-
)
2352-
with pytest.warns(UserWarning, match=warn_match):
2347+
with pytest.warns(UserWarning, match="baseline=None and fill=True"):
23532348
ax.stairs(
23542349
[4, 5, 1, 0, 2],
23552350
[1, 2, 3, 4, 5, 6],
23562351
facecolor="blue",
2357-
baseline=baseline,
2358-
fill=fill
2352+
baseline=None,
2353+
fill=True
23592354
)
23602355

23612356

0 commit comments

Comments
 (0)
0