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

Skip to content

Commit 17f0ef3

Browse files
committed
TST: Add test case for bug fix.
1 parent 859993b commit 17f0ef3

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8040,6 +8040,19 @@ def test_centered_bar_label_nonlinear():
80408040
ax.set_axis_off()
80418041

80428042

8043+
def test_centered_bar_label_label_beyond_limits(tmp_path):
8044+
_, ax = plt.subplots()
8045+
8046+
last = 0
8047+
for label, value in zip(['a', 'b', 'c'], [10, 20, 50]):
8048+
bar_container = ax.barh('col', value, label=label, left=last)
8049+
ax.bar_label(bar_container, label_type='center')
8050+
last += value
8051+
ax.set_xlim(None, 20)
8052+
8053+
plt.savefig(tmp_path / 'test')
8054+
8055+
80438056
def test_bar_label_location_errorbars():
80448057
ax = plt.gca()
80458058
xs, heights = [1, 2], [3, -4]

0 commit comments

Comments
 (0)