File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 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):
38533853 (data_line , tuple (caplines ), tuple (barcols )),
38543854 has_xerr = (xerr is not None ), has_yerr = (yerr is not None ),
38553855 label = label )
3856- self .containers . append (errorbar_container )
3856+ self .add_container (errorbar_container )
38573857
38583858 return errorbar_container # (l0, caplines, barcols)
38593859
Original file line number Diff line number Diff line change @@ -4274,6 +4274,24 @@ def test_errorbar_nonefmt():
42744274 assert np .all (errbar .get_color () == mcolors .to_rgba ('C0' ))
42754275
42764276
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+
42774295def test_errorbar_line_specific_kwargs ():
42784296 # Check that passing line-specific keyword arguments will not result in
42794297 # errors.
You can’t perform that action at this time.
0 commit comments