Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5a43452

Browse files
Merge pull request#29401 from rcomer/errorbar-remove
FIX: add errorbars with `add_container`
2 parents147ddab +a39e2d6 commit5a43452

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

‎lib/matplotlib/axes/_axes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3853,7 +3853,7 @@ def apply_mask(arrays, mask):
38533853
(data_line,tuple(caplines),tuple(barcols)),
38543854
has_xerr=(xerrisnotNone),has_yerr=(yerrisnotNone),
38553855
label=label)
3856-
self.containers.append(errorbar_container)
3856+
self.add_container(errorbar_container)
38573857

38583858
returnerrorbar_container# (l0, caplines, barcols)
38593859

‎lib/matplotlib/tests/test_axes.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4274,6 +4274,24 @@ def test_errorbar_nonefmt():
42744274
assertnp.all(errbar.get_color()==mcolors.to_rgba('C0'))
42754275

42764276

4277+
deftest_errorbar_remove():
4278+
x=np.arange(5)
4279+
y=np.arange(5)
4280+
4281+
fig,ax=plt.subplots()
4282+
ec=ax.errorbar(x,y,xerr=1,yerr=1)
4283+
4284+
assertlen(ax.containers)==1
4285+
assertlen(ax.lines)==5
4286+
assertlen(ax.collections)==2
4287+
4288+
ec.remove()
4289+
4290+
assertnotax.containers
4291+
assertnotax.lines
4292+
assertnotax.collections
4293+
4294+
42774295
deftest_errorbar_line_specific_kwargs():
42784296
# Check that passing line-specific keyword arguments will not result in
42794297
# errors.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp