changeset 30363:1b14241560fa

maint: merge stable to default.
author Markus Mützel <markus.muetzel@gmx.de>
date Thu, 25 Nov 2021 15:29:20 +0100
parents ac7ea24140ec (current diff) 512f3d68bb49 (diff)
children 17c27b8cda69
files
diffstat 3 files changed, 20 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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 <a graphics handle>
+%! 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
--- 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))
--- 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:
 ##