Mercurial > octave
changeset 21658:2f9078956a63
don't open new figures unnecessarily in demos
* brighten.m, contrast.m, copyobj.m: Reuse existing figure (if any) by
calling clf instead of figure for the first figure window.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 29 Apr 2016 16:37:30 -0400 |
parents | b45d53d1d638 |
children | ff2347e1df02 |
files | scripts/image/brighten.m scripts/image/contrast.m scripts/plot/util/copyobj.m |
diffstat | 3 files changed, 6 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/image/brighten.m Fri Apr 29 16:35:41 2016 -0400 +++ b/scripts/image/brighten.m Fri Apr 29 16:37:30 2016 -0400 @@ -84,7 +84,7 @@ %!demo %! ## First figure uses default grayscale colormap -%! figure; +%! clf; %! colormap (gray (64)); %! image (1:64, linspace (0, 1, 64), repmat ((1:64)', 1, 64)); %! axis ([1, 64, 0, 1], "ticy", "xy");
--- a/scripts/image/contrast.m Fri Apr 29 16:35:41 2016 -0400 +++ b/scripts/image/contrast.m Fri Apr 29 16:37:30 2016 -0400 @@ -49,7 +49,7 @@ %!demo -%! figure; +%! clf; %! img = reshape (1:100, 10, 10); %! imagesc (img); %! colormap (gray (64));
--- a/scripts/plot/util/copyobj.m Fri Apr 29 16:35:41 2016 -0400 +++ b/scripts/plot/util/copyobj.m Fri Apr 29 16:37:30 2016 -0400 @@ -116,7 +116,8 @@ ## with FLTK backend which is not respecting the set ('position') call. %!demo -%! hobj = figure ('name', 'Original', 'numbertitle', 'off'); +%! hobj = clf; +%! set (hobj, 'name', 'Original', 'numbertitle', 'off'); %! hold on; %! x = 1:10; %! y = x.^2; @@ -139,7 +140,8 @@ %! drawnow (); %!demo -%! hobj = figure ('name', 'Original', 'numbertitle', 'off'); +%! hobj = clf; +%! set (hobj, 'name', 'Original', 'numbertitle', 'off'); %! subplot (2,2,1); %! hold on; %! contourf (rand (10, 10));