# HG changeset patch # User Markus Mützel # Date 1637850560 -3600 # Node ID 1b14241560fa20d22e5ae46d3c725d1dac4334c4 # Parent ac7ea24140ecb94379673d7ef744bfd50e35dc60# Parent 512f3d68bb49e7f9aebd96dc444667fd123107a0 maint: merge stable to default. diff -r ac7ea24140ec -r 1b14241560fa scripts/plot/util/print.m --- a/scripts/plot/util/print.m Wed Nov 24 22:07:56 2021 -0800 +++ b/scripts/plot/util/print.m Thu Nov 25 15:29:20 2021 +0100 @@ -808,6 +808,18 @@ endfunction +%!error +%! hf = figure ("visible", "off"); +%! unwind_protect +%! x = 0:0.1:1; +%! y1 = x; +%! y2 = 2*x; +%! ax = plotyy (x, y1, x, y2); +%! saveas (ax, [tempname(), ".png"]); +%! unwind_protect_cleanup +%! close (hf); +%! end_unwind_protect + function cmd = epstool (opts, filein, fileout) ## As epstool does not work with pipes, a subshell is used to ## permit piping. Since this solution does not work with the DOS diff -r ac7ea24140ec -r 1b14241560fa scripts/plot/util/private/__print_parse_opts__.m --- a/scripts/plot/util/private/__print_parse_opts__.m Wed Nov 24 22:07:56 2021 -0800 +++ b/scripts/plot/util/private/__print_parse_opts__.m Thu Nov 25 15:29:20 2021 +0100 @@ -89,6 +89,9 @@ endif for i = 1:numel (varargin) + if (! ischar (varargin{i}) && ! iscellstr (varargin{i})) + error ("print: input arguments must be a graphics handle or strings."); + endif arg = strtrim (varargin{i}); if (ischar (arg)) if (isempty (arg)) diff -r ac7ea24140ec -r 1b14241560fa scripts/plot/util/saveas.m --- a/scripts/plot/util/saveas.m Wed Nov 24 22:07:56 2021 -0800 +++ b/scripts/plot/util/saveas.m Thu Nov 25 15:29:20 2021 +0100 @@ -26,9 +26,13 @@ ## -*- texinfo -*- ## @deftypefn {} {} saveas (@var{h}, @var{filename}) ## @deftypefnx {} {} saveas (@var{h}, @var{filename}, @var{fmt}) -## Save graphic object @var{h} to the file @var{filename} in graphic format +## Save graphics object @var{h} to the file @var{filename} in graphics format ## @var{fmt}. ## +## If @var{h} is the handle to a figure object, that figure object is saved. +## If @var{h} is the handle to a different graphics object, the figure +## containing that graphics object is saved. +## ## All device formats accepted by @code{print} may be used. Common formats ## are: ##