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 @@ -3861,7 +3861,7 @@ def apply_mask(arrays, mask):
38613861 (data_line , tuple (caplines ), tuple (barcols )),
38623862 has_xerr = (xerr is not None ), has_yerr = (yerr is not None ),
38633863 label = label )
3864- self .containers . append (errorbar_container )
3864+ self .add_container (errorbar_container )
38653865
38663866 return errorbar_container # (l0, caplines, barcols)
38673867
Original file line number Diff line number Diff line change @@ -4225,6 +4225,24 @@ def test_errorbar_nonefmt():
42254225 assert np .all (errbar .get_color () == mcolors .to_rgba ('C0' ))
42264226
42274227
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+
42284246def test_errorbar_line_specific_kwargs ():
42294247 # Check that passing line-specific keyword arguments will not result in
42304248 # errors.
You can’t perform that action at this time.
0 commit comments