File tree 2 files changed +19
-1
lines changed
2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -3861,7 +3861,7 @@ def apply_mask(arrays, mask):
3861
3861
(data_line , tuple (caplines ), tuple (barcols )),
3862
3862
has_xerr = (xerr is not None ), has_yerr = (yerr is not None ),
3863
3863
label = label )
3864
- self .containers . append (errorbar_container )
3864
+ self .add_container (errorbar_container )
3865
3865
3866
3866
return errorbar_container # (l0, caplines, barcols)
3867
3867
Original file line number Diff line number Diff line change @@ -4225,6 +4225,24 @@ def test_errorbar_nonefmt():
4225
4225
assert np .all (errbar .get_color () == mcolors .to_rgba ('C0' ))
4226
4226
4227
4227
4228
+ def test_errorbar_remove ():
4229
+ x = np .arange (5 )
4230
+ y = np .arange (5 )
4231
+
4232
+ fig , ax = plt .subplots ()
4233
+ ec = ax .errorbar (x , y , xerr = 1 , yerr = 1 )
4234
+
4235
+ assert len (ax .containers ) == 1
4236
+ assert len (ax .lines ) == 5
4237
+ assert len (ax .collections ) == 2
4238
+
4239
+ ec .remove ()
4240
+
4241
+ assert not ax .containers
4242
+ assert not ax .lines
4243
+ assert not ax .collections
4244
+
4245
+
4228
4246
def test_errorbar_line_specific_kwargs ():
4229
4247
# Check that passing line-specific keyword arguments will not result in
4230
4248
# errors.
You can’t perform that action at this time.
0 commit comments