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

Skip to content

Commit f7554ba

Browse files
committed
Set sticky_edges correctly for negative height bar().
The patch correctly sets the sticky edge to 0 instead of -1 for `bar(0, height=-1)`.
1 parent eaf05e9 commit f7554ba

File tree

2 files changed

+0
-17
lines changed

2 files changed

+0
-17
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2113,12 +2113,6 @@ def make_iterable(x):
21132113

21142114
args = zip(left, bottom, width, height, color, edgecolor, linewidth)
21152115
for l, b, w, h, c, e, lw in args:
2116-
if h < 0:
2117-
b += h
2118-
h = abs(h)
2119-
if w < 0:
2120-
l += w
2121-
w = abs(w)
21222116
r = mpatches.Rectangle(
21232117
xy=(l, b), width=w, height=h,
21242118
facecolor=c,

lib/matplotlib/tests/test_axes.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4379,17 +4379,6 @@ def test_rc_major_minor_tick():
43794379
assert yax._minor_tick_kw['tick2On'] == True
43804380

43814381

4382-
@cleanup
4383-
def test_bar_negative_width():
4384-
fig, ax = plt.subplots()
4385-
res = ax.bar(range(1, 5), range(1, 5), width=-1)
4386-
assert len(res) == 4
4387-
for indx, b in enumerate(res):
4388-
assert b._x == indx
4389-
assert b._width == 1
4390-
assert b._height == indx + 1
4391-
4392-
43934382
@cleanup
43944383
def test_square_plot():
43954384
x = np.arange(4)

0 commit comments

Comments
 (0)