Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents cebc4d8 + 55f8251 commit 3a6f5cdCopy full SHA for 3a6f5cd
2 files changed
lib/matplotlib/axes/_axes.py
@@ -7268,14 +7268,14 @@ def stairs(self, values, edges=None, *,
7268
"very likely that the resulting fill patterns is not the desired "
7269
"result."
7270
)
7271
- if baseline is None:
7272
- baseline = 0
7273
- if orientation == 'vertical':
7274
- patch.sticky_edges.y.append(np.min(baseline))
7275
- self.update_datalim([(edges[0], np.min(baseline))])
7276
- else:
7277
- patch.sticky_edges.x.append(np.min(baseline))
7278
- self.update_datalim([(np.min(baseline), edges[0])])
+
+ if baseline is not None:
+ if orientation == 'vertical':
+ patch.sticky_edges.y.append(np.min(baseline))
+ self.update_datalim([(edges[0], np.min(baseline))])
+ else:
+ patch.sticky_edges.x.append(np.min(baseline))
+ self.update_datalim([(np.min(baseline), edges[0])])
7279
self._request_autoscale_view()
7280
return patch
7281
lib/matplotlib/tests/test_axes.py
@@ -2479,16 +2479,17 @@ def test_stairs_update(fig_test, fig_ref):
2479
2480
2481
@check_figures_equal(extensions=['png'])
2482
-def test_stairs_baseline_0(fig_test, fig_ref):
2483
- # Test
2484
- test_ax = fig_test.add_subplot()
2485
- test_ax.stairs([5, 6, 7], baseline=None)
+def test_stairs_baseline_None(fig_test, fig_ref):
+ x = np.array([0, 2, 3, 5, 10])
+ y = np.array([1.148, 1.231, 1.248, 1.25])
2486
+ test_axes = fig_test.add_subplot()
2487
+ test_axes.stairs(y, x, baseline=None)
2488
- # Ref
- ref_ax = fig_ref.add_subplot()
2489
style = {'solid_joinstyle': 'miter', 'solid_capstyle': 'butt'}
2490
- ref_ax.plot(range(4), [5, 6, 7, 7], drawstyle='steps-post', **style)
2491
- ref_ax.set_ylim(0, None)
+ ref_axes = fig_ref.add_subplot()
2492
+ ref_axes.plot(x, np.append(y, y[-1]), drawstyle='steps-post', **style)
2493
2494
2495
def test_stairs_empty():
0 commit comments