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 @@ -3853,7 +3853,7 @@ def apply_mask(arrays, mask):
3853
3853
(data_line , tuple (caplines ), tuple (barcols )),
3854
3854
has_xerr = (xerr is not None ), has_yerr = (yerr is not None ),
3855
3855
label = label )
3856
- self .containers . append (errorbar_container )
3856
+ self .add_container (errorbar_container )
3857
3857
3858
3858
return errorbar_container # (l0, caplines, barcols)
3859
3859
Original file line number Diff line number Diff line change @@ -4274,6 +4274,24 @@ def test_errorbar_nonefmt():
4274
4274
assert np .all (errbar .get_color () == mcolors .to_rgba ('C0' ))
4275
4275
4276
4276
4277
+ def test_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
+ assert len (ax .containers ) == 1
4285
+ assert len (ax .lines ) == 5
4286
+ assert len (ax .collections ) == 2
4287
+
4288
+ ec .remove ()
4289
+
4290
+ assert not ax .containers
4291
+ assert not ax .lines
4292
+ assert not ax .collections
4293
+
4294
+
4277
4295
def test_errorbar_line_specific_kwargs ():
4278
4296
# Check that passing line-specific keyword arguments will not result in
4279
4297
# errors.
You can’t perform that action at this time.
0 commit comments