Mercurial > hg > octave-nkf
changeset 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 | 9fee0b741de6 |
children | e88b31c485c0 |
files | scripts/plot/copyobj.m |
diffstat | 1 files changed, 10 insertions(+), 0 deletions(-) [+] |
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