diff --git a/wafo/graphutil.py b/wafo/graphutil.py index 0dfcd53..f98fcaa 100644 --- a/wafo/graphutil.py +++ b/wafo/graphutil.py @@ -43,7 +43,7 @@ def delete_text_object(gidtxt, figure=None, axis=None, verbose=False): def lmatchfun(x): return _matchfun(x, gidtxt) - for handle in [axis, figure]: + def _delete_gid_objects(handle, gidtxt, verbose): objs = handle.findobj(lmatchfun) name = handle.__name__ msg = "Tried to delete a non-existing {0} from {1}".format(gidtxt, @@ -55,6 +55,9 @@ def delete_text_object(gidtxt, figure=None, axis=None, verbose=False): if verbose: warnings.warn(msg) + for handle in [axis, figure]: + _delete_gid_objects(handle, gidtxt, verbose) + def cltext(levels, percent=False, n=4, xs=0.036, ys=0.94, zs=0, figure=None, axis=None):