Mercurial > hg > octave-lyh
diff scripts/plot/copyobj.m @ 15710:cd3d7f126190
copyobj.m: ensure gca() and gcf() are reset to original values
author | pantxo <pantxo.diribarne@gmail.com> |
---|---|
date | Mon, 19 Nov 2012 16:15:05 +0100 |
parents | efbc896c1ecc |
children | 84db9338c448 |
line wrap: on
line diff
--- a/scripts/plot/copyobj.m +++ b/scripts/plot/copyobj.m @@ -41,6 +41,10 @@ print_usage (); endif + ## current figure and axes + cf = gcf (); + ca = gca (); + ## compatibility of input handles kididx = find (strcmp (alltypes, get (horig).type)); paridx = find (strcmp (alltypes, get (hparent).type)); @@ -56,6 +60,12 @@ hnew = struct2hdl (str, hparent); endif + ## reset current figure (and eventually axes) to original + set (0, "currentfigure", cf); + if (get (hnew, "parent") == cf) + set (cf, "currentaxes", ca) + endif + endfunction