Skip to content

Commit e1602fd

Browse files
committed
Fix pre-commits, add whatsnew documentation
1 parent 44705a8 commit e1602fd

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

doc/source/whatsnew/v2.3.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ Period
143143

144144
Plotting
145145
^^^^^^^^
146-
-
146+
- Bug in :meth:`DataFrame.plot.bar` with ``stacked=True`` where labels on stacked bars with zero-height segments were incorrectly positioned at the base instead of the label position of the previous segment (:issue:`59429`)
147147
-
148148

149149
Groupby/resample/rolling

pandas/tests/plotting/frame/test_frame.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -775,10 +775,10 @@ def test_bar_nan_stacked(self):
775775
assert result == expected
776776

777777
def test_bar_stacked_label_position_with_zero_height(self):
778-
df = pd.DataFrame({"A": [3, 0, 1], "B": [0, 2, 4], "C": [5, 0, 2]})
778+
df = DataFrame({"A": [3, 0, 1], "B": [0, 2, 4], "C": [5, 0, 2]})
779779
ax = df.plot.bar(stacked=True)
780780
ax.bar_label(ax.containers[-1])
781-
expected = [8., 2., 7.]
781+
expected = [8.0, 2.0, 7.0]
782782
result = [text.xy[1] for text in ax.texts]
783783
tm.assert_almost_equal(result, expected)
784784
plt.close("all")

0 commit comments

Comments
 (0)