Mercurial > octave
changeset 26851:4d7665fc8f6c stable
line.m: Fix creation of unwanted axes (bug #55840)
* line.m: Save/restore figure when plotting into an axes other than gca.
author | Rik <rik@octave.org> |
---|---|
date | Tue, 05 Mar 2019 17:29:38 -0800 |
parents | 55e087e232fe |
children | 98f34c841f89 b0f359a5ad35 |
files | scripts/plot/draw/line.m |
diffstat | 1 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/draw/line.m Mon Mar 04 11:42:18 2019 -0800 +++ b/scripts/plot/draw/line.m Tue Mar 05 17:29:38 2019 -0800 @@ -68,11 +68,20 @@ if (isempty (hax)) hax = gca (); + oldfig = []; else hax = hax(1); + oldfig = get (0, "currentfigure"); + set (0, "currentfigure", ancestor (hax, "figure")); endif - htmp = __line__ (hax, varargin{:}); + unwind_protect + htmp = __line__ (hax, varargin{:}); + unwind_protect_cleanup + if (! isempty (oldfig)) + set (0, "currentfigure", oldfig); + endif + end_unwind_protect if (nargout > 0) h = htmp;