comparison scripts/plot/util/__gnuplot_drawnow__.m @ 17572:7bb76a22cde1

maint: Split scripts/plot directory into 4 pieces. scripts/gui : user-interface functions scripts/plot/appearance : functions controlling plot appearance scripts/plot/draw : plotting functions which produce graphs scripts/plot/util : low-level plotting functions and utilities. * scripts/gui/guidata.m, scripts/gui/guihandles.m, scripts/gui/module.mk, scripts/gui/private/__file_filter__.m, scripts/gui/private/__fltk_file_filter__.m, scripts/gui/private/__is_function__.m, scripts/gui/private/__uigetdir_fltk__.m, scripts/gui/private/__uigetfile_fltk__.m, scripts/gui/private/__uiobject_split_args__.m, scripts/gui/private/__uiputfile_fltk__.m, scripts/gui/uicontextmenu.m, scripts/gui/uicontrol.m, scripts/gui/uigetdir.m, scripts/gui/uigetfile.m, scripts/gui/uimenu.m, scripts/gui/uipanel.m, scripts/gui/uipushtool.m, scripts/gui/uiputfile.m, scripts/gui/uiresume.m, scripts/gui/uitoggletool.m, scripts/gui/uitoolbar.m, scripts/gui/uiwait.m, scripts/gui/waitbar.m, scripts/gui/waitforbuttonpress.m: Moved from scripts/plot to scripts/gui * scripts/plot/appearance/__clabel__.m, scripts/plot/appearance/__getlegenddata__.m, scripts/plot/appearance/axis.m, scripts/plot/appearance/box.m, scripts/plot/appearance/caxis.m, scripts/plot/appearance/clabel.m, scripts/plot/appearance/daspect.m, scripts/plot/appearance/diffuse.m, scripts/plot/appearance/grid.m, scripts/plot/appearance/gtext.m, scripts/plot/appearance/hidden.m, scripts/plot/appearance/legend.m, scripts/plot/appearance/orient.m, scripts/plot/appearance/pbaspect.m, scripts/plot/appearance/private/__axis_label__.m, scripts/plot/appearance/private/__axis_limits__.m, scripts/plot/appearance/shading.m, scripts/plot/appearance/specular.m, scripts/plot/appearance/text.m, scripts/plot/appearance/title.m, scripts/plot/appearance/view.m, scripts/plot/appearance/whitebg.m, scripts/plot/appearance/xlabel.m, scripts/plot/appearance/xlim.m, scripts/plot/appearance/ylabel.m, scripts/plot/appearance/ylim.m, scripts/plot/appearance/zlabel.m, scripts/plot/appearance/zlim.m: Moved from scripts/plot to subdir appearance. * scripts/plot/draw/area.m, scripts/plot/draw/bar.m, scripts/plot/draw/barh.m, scripts/plot/draw/colorbar.m, scripts/plot/draw/comet.m, scripts/plot/draw/comet3.m, scripts/plot/draw/compass.m, scripts/plot/draw/contour.m, scripts/plot/draw/contour3.m, scripts/plot/draw/contourc.m, scripts/plot/draw/contourf.m, scripts/plot/draw/cylinder.m, scripts/plot/draw/ellipsoid.m, scripts/plot/draw/errorbar.m, scripts/plot/draw/ezcontour.m, scripts/plot/draw/ezcontourf.m, scripts/plot/draw/ezmesh.m, scripts/plot/draw/ezmeshc.m, scripts/plot/draw/ezplot.m, scripts/plot/draw/ezplot3.m, scripts/plot/draw/ezpolar.m, scripts/plot/draw/ezsurf.m, scripts/plot/draw/ezsurfc.m, scripts/plot/draw/feather.m, scripts/plot/draw/fill.m, scripts/plot/draw/fplot.m, scripts/plot/draw/hist.m, scripts/plot/draw/isocolors.m, scripts/plot/draw/isonormals.m, scripts/plot/draw/isosurface.m, scripts/plot/draw/line.m, scripts/plot/draw/loglog.m, scripts/plot/draw/loglogerr.m, scripts/plot/draw/mesh.m, scripts/plot/draw/meshc.m, scripts/plot/draw/meshz.m, scripts/plot/draw/pareto.m, scripts/plot/draw/patch.m, scripts/plot/draw/pcolor.m, scripts/plot/draw/peaks.m, scripts/plot/draw/pie.m, scripts/plot/draw/pie3.m, scripts/plot/draw/plot.m, scripts/plot/draw/plot3.m, scripts/plot/draw/plotmatrix.m, scripts/plot/draw/plotyy.m, scripts/plot/draw/polar.m, scripts/plot/draw/private/__add_datasource__.m, scripts/plot/draw/private/__bar__.m, scripts/plot/draw/private/__contour__.m, scripts/plot/draw/private/__errcomm__.m, scripts/plot/draw/private/__errplot__.m, scripts/plot/draw/private/__ezplot__.m, scripts/plot/draw/private/__interp_cube__.m, scripts/plot/draw/private/__line__.m, scripts/plot/draw/private/__marching_cube__.m, scripts/plot/draw/private/__patch__.m, scripts/plot/draw/private/__pie__.m, scripts/plot/draw/private/__plt__.m, scripts/plot/draw/private/__quiver__.m, scripts/plot/draw/private/__scatter__.m, scripts/plot/draw/private/__stem__.m, scripts/plot/draw/quiver.m, scripts/plot/draw/quiver3.m, scripts/plot/draw/rectangle.m, scripts/plot/draw/ribbon.m, scripts/plot/draw/rose.m, scripts/plot/draw/scatter.m, scripts/plot/draw/scatter3.m, scripts/plot/draw/semilogx.m, scripts/plot/draw/semilogxerr.m, scripts/plot/draw/semilogy.m, scripts/plot/draw/semilogyerr.m, scripts/plot/draw/shrinkfaces.m, scripts/plot/draw/slice.m, scripts/plot/draw/sombrero.m, scripts/plot/draw/sphere.m, scripts/plot/draw/stairs.m, scripts/plot/draw/stem.m, scripts/plot/draw/stem3.m, scripts/plot/draw/stemleaf.m, scripts/plot/draw/surf.m, scripts/plot/draw/surface.m, scripts/plot/draw/surfc.m, scripts/plot/draw/surfl.m, scripts/plot/draw/surfnorm.m, scripts/plot/draw/tetramesh.m, scripts/plot/draw/trimesh.m, scripts/plot/draw/triplot.m, scripts/plot/draw/trisurf.m, scripts/plot/draw/waterfall.m: Moved from plot/ to subdir draw. * scripts/plot/util/__actual_axis_position__.m, scripts/plot/util/__default_plot_options__.m, scripts/plot/util/__gnuplot_drawnow__.m, scripts/plot/util/__next_line_color__.m, scripts/plot/util/__next_line_style__.m, scripts/plot/util/__plt_get_axis_arg__.m, scripts/plot/util/__pltopt__.m, scripts/plot/util/allchild.m, scripts/plot/util/ancestor.m, scripts/plot/util/axes.m, scripts/plot/util/cla.m, scripts/plot/util/clf.m, scripts/plot/util/close.m, scripts/plot/util/closereq.m, scripts/plot/util/colstyle.m, scripts/plot/util/copyobj.m, scripts/plot/util/figure.m, scripts/plot/util/findall.m, scripts/plot/util/findfigs.m, scripts/plot/util/findobj.m, scripts/plot/util/gca.m, scripts/plot/util/gcbf.m, scripts/plot/util/gcbo.m, scripts/plot/util/gcf.m, scripts/plot/util/gco.m, scripts/plot/util/ginput.m, scripts/plot/util/gnuplot_binary.in, scripts/plot/util/graphics_toolkit.m, scripts/plot/util/hdl2struct.m, scripts/plot/util/hggroup.m, scripts/plot/util/hold.m, scripts/plot/util/isaxes.m, scripts/plot/util/isfigure.m, scripts/plot/util/ishghandle.m, scripts/plot/util/ishold.m, scripts/plot/util/isprop.m, scripts/plot/util/linkprop.m, scripts/plot/util/meshgrid.m, scripts/plot/util/ndgrid.m, scripts/plot/util/newplot.m, scripts/plot/util/print.m, scripts/plot/util/printd.m, scripts/plot/util/private/__add_default_menu__.m, scripts/plot/util/private/__fltk_ginput__.m, scripts/plot/util/private/__fltk_print__.m, scripts/plot/util/private/__ghostscript__.m, scripts/plot/util/private/__gnuplot_get_var__.m, scripts/plot/util/private/__gnuplot_ginput__.m, scripts/plot/util/private/__gnuplot_has_feature__.m, scripts/plot/util/private/__gnuplot_has_terminal__.m, scripts/plot/util/private/__gnuplot_open_stream__.m, scripts/plot/util/private/__gnuplot_print__.m, scripts/plot/util/private/__gnuplot_version__.m, scripts/plot/util/private/__go_draw_axes__.m, scripts/plot/util/private/__go_draw_figure__.m, scripts/plot/util/private/__print_parse_opts__.m, scripts/plot/util/private/__tight_eps_bbox__.m, scripts/plot/util/refresh.m, scripts/plot/util/refreshdata.m, scripts/plot/util/saveas.m, scripts/plot/util/shg.m, scripts/plot/util/struct2hdl.m, scripts/plot/util/subplot.m: Moved from plot to subdir util. * etc/HACKING: Updated directory structure info. * scripts/Makefile.am, scripts/plot/appearance/module.mk, scripts/plot/draw/module.mk, scripts/plot/util/module.mk: Added new directories to build system.
author Rik <rik@octave.org>
date Fri, 04 Oct 2013 17:09:08 -0700
parents scripts/plot/__gnuplot_drawnow__.m@3f0ed69d21c6
children d63878346099
comparison
equal deleted inserted replaced
17571:6e4ea5c8a4bb 17572:7bb76a22cde1
1 ## Copyright (C) 2005-2012 John W. Eaton
2 ##
3 ## This file is part of Octave.
4 ##
5 ## Octave is free software; you can redistribute it and/or modify it
6 ## under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation; either version 3 of the License, or (at
8 ## your option) any later version.
9 ##
10 ## Octave is distributed in the hope that it will be useful, but
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 ## General Public License for more details.
14 ##
15 ## You should have received a copy of the GNU General Public License
16 ## along with Octave; see the file COPYING. If not, see
17 ## <http://www.gnu.org/licenses/>.
18
19 ## -*- texinfo -*-
20 ## @deftypefn {Function File} {} __gnuplot_drawnow__ (@var{h}, @var{term}, @var{file}, @var{mono}, @var{debug_file})
21 ## Undocumented internal function.
22 ## @end deftypefn
23
24 ## Author: jwe
25
26 function __gnuplot_drawnow__ (h, term, file, mono = false, debug_file)
27
28 if (nargin < 1 || nargin > 5 || nargin == 2)
29 print_usage ();
30 endif
31
32 if (nargin >= 3 && nargin <= 5)
33 ## Produce various output formats, or redirect gnuplot stream to a
34 ## debug file.
35 plot_stream = [];
36 fid = [];
37 default_plot_stream = get (h, "__plot_stream__");
38 unwind_protect
39 plot_stream = __gnuplot_open_stream__ (2, h);
40 gnuplot_supports_term = __gnuplot_has_terminal__ (term, plot_stream);
41 if (gnuplot_supports_term)
42 enhanced = gnuplot_set_term (plot_stream(1), true, h, term, file);
43 __go_draw_figure__ (h, plot_stream(1), enhanced, mono);
44 if (nargin == 5)
45 fid = fopen (debug_file, "wb");
46 enhanced = gnuplot_set_term (fid, true, h, term, file);
47 __go_draw_figure__ (h, fid, enhanced, mono);
48 endif
49 else
50 error ('__gnuplot_drawnow__: the gnuplot terminal, "%s", is not available',
51 gnuplot_trim_term (term));
52 endif
53 unwind_protect_cleanup
54 set (h, "__plot_stream__", default_plot_stream);
55 if (! isempty (plot_stream))
56 pclose (plot_stream(1));
57 if (numel (plot_stream) > 1)
58 pclose (plot_stream(2));
59 endif
60 if (numel (plot_stream) > 2)
61 waitpid (plot_stream(3));
62 endif
63 endif
64 if (! isempty (fid))
65 fclose (fid);
66 endif
67 end_unwind_protect
68 else # nargin == 1
69 ## Graphics terminal for display.
70 plot_stream = get (h, "__plot_stream__");
71 if (isempty (plot_stream))
72 plot_stream = __gnuplot_open_stream__ (2, h);
73 new_stream = true;
74 else
75 new_stream = false;
76 endif
77 term = gnuplot_default_term (plot_stream);
78 if (strcmp (term, "dumb"))
79 ## popen2 eats stdout of gnuplot, use temporary file instead
80 dumb_tmp_file = tmpnam ();
81 enhanced = gnuplot_set_term (plot_stream(1), new_stream, h,
82 term, dumb_tmp_file);
83 else
84 enhanced = gnuplot_set_term (plot_stream(1), new_stream, h, term);
85 endif
86 __go_draw_figure__ (h, plot_stream(1), enhanced, mono);
87 fflush (plot_stream(1));
88 if (strcmp (term, "dumb"))
89 fid = -1;
90 while (fid < 0)
91 pause (0.1);
92 fid = fopen (dumb_tmp_file, 'r');
93 endwhile
94 ## reprint the plot on screen
95 [a, count] = fscanf (fid, '%c', Inf);
96 fclose (fid);
97 if (count > 0)
98 if (a(1) == 12)
99 a = a(2:end); # avoid ^L at the beginning
100 endif
101 puts (a);
102 endif
103 unlink (dumb_tmp_file);
104 endif
105 endif
106
107 endfunction
108
109 function enhanced = gnuplot_set_term (plot_stream, new_stream, h, term, file)
110 ## Generate the gnuplot "set terminal <term> ..." command.
111 ## When "term" originates from print.m, it may include other options.
112 if (nargin < 4)
113 ## This supports the gnuplot graphics toolkit.
114 term = gnuplot_default_term (plot_stream);
115 opts_str = "";
116 else
117 ## Get the one word terminal id and save the remaining as options to be
118 ## passed on to gnuplot. The terminal may respect the graphics toolkit.
119 [term, opts_str] = gnuplot_trim_term (term);
120 term = lower (term);
121 if (strcmp (term, "lua"))
122 ## Replace "lua tikz" with just "tikz"
123 term = "tikz";
124 opts_str = strrep (opts_str, "tikz", "");
125 endif
126 endif
127
128 if (strfind (opts_str, "noenhanced"))
129 enhanced = false;
130 else
131 enhanced = gnuplot_is_enhanced_term (plot_stream, term);
132 endif
133
134 ## Set the terminal.
135 if (! isempty (term))
136
137 if (enhanced)
138 enh_str = "enhanced";
139 else
140 enh_str = "";
141 endif
142
143 if (! isempty (h) && isfigure (h))
144
145 ## Generate gnuplot title string for plot windows.
146 if (output_to_screen (term) && ! strcmp (term, "dumb"))
147 fig.numbertitle = get (h, "numbertitle");
148 fig.name = strrep (get (h, "name"), '"', '\"');
149 if (strcmp (get (h, "numbertitle"), "on"))
150 title_str = sprintf ("Figure %d", h);
151 else
152 title_str = "";
153 endif
154 if (! isempty (fig.name) && ! isempty (title_str))
155 title_str = sprintf ("%s: %s", title_str, fig.name);
156 elseif (! isempty (fig.name) && isempty (title_str))
157 title_str = fig.name;
158 endif
159 if (! isempty (title_str))
160 title_str = sprintf ('title "%s"', title_str);
161 endif
162 if (strcmp (term, "aqua"))
163 ## Adjust axes-label and tick-label spacing.
164 opts_str = sprintf ('%s font "%s,%d"', opts_str,
165 get (0, "defaultaxesfontname"),
166 get (0, "defaultaxesfontsize") / 1.5);
167 endif
168 else
169 title_str = "";
170 endif
171
172 if (! (any (strfind (opts_str, " size ") > 0)
173 || any (strfind (opts_str, "size ") == 1)))
174 ## Get figure size in pixels. Rely on listener to handle coversion.
175 units = get (h, "units");
176 unwind_protect
177 set (h, "units", "pixels");
178 position_in_pixels = get (h, "position");
179 unwind_protect_cleanup
180 set (h, "units", units);
181 end_unwind_protect
182 gnuplot_pos = position_in_pixels(1:2);
183 gnuplot_size = position_in_pixels(3:4);
184 if (! (output_to_screen (term)
185 || any (strcmp (term, {"canvas", "emf", "gif", "jpeg", ...
186 "pbm", "png", "pngcairo", "svg"}))))
187 ## Convert to inches
188 gnuplot_pos = gnuplot_pos / 72;
189 gnuplot_size = gnuplot_size / 72;
190 endif
191 if (all (gnuplot_size > 0))
192 terminals_with_size = {"canvas", "emf", "epslatex", "fig", ...
193 "gif", "jpeg", "latex", "pbm", "pdf", ...
194 "pdfcairo", "postscript", "png", ...
195 "pngcairo", "pstex", "pslatex", "svg", "tikz"};
196 if (__gnuplot_has_feature__ ("windows_figure_position"))
197 terminals_with_size{end+1} = "windows";
198 endif
199 if (__gnuplot_has_feature__ ("x11_figure_position"))
200 terminals_with_size{end+1} = "x11";
201 endif
202 if (__gnuplot_has_feature__ ("wxt_figure_size"))
203 terminals_with_size{end+1} = "wxt";
204 endif
205 switch (term)
206 case terminals_with_size
207 size_str = sprintf ("size %.12g,%.12g", gnuplot_size);
208 case "tikz"
209 size_str = sprintf ("size %gin,%gin", gnuplot_size);
210 case "dumb"
211 new_stream = 1;
212 if (!isempty (getenv ("COLUMNS")) && !isempty (getenv ("LINES")))
213 ## Let dumb use full text screen size (minus prompt lines).
214 n = sprintf ("%i", -2 - length (find (sprintf ("%s", PS1) == "\n")));
215 ## n = the number of times \n appears in PS1
216 size_str = ["size " getenv("COLUMNS") "," getenv("LINES") n];
217 else
218 ## Use the gnuplot default.
219 size_str = "";
220 endif
221 case {"aqua", "fig", "corel"}
222 size_str = sprintf ("size %g %g", gnuplot_size);
223 case "dxf"
224 size_str = "";
225 otherwise
226 size_str = "";
227 endswitch
228 if ((strcmp (term, "x11")
229 && __gnuplot_has_feature__ ("x11_figure_position"))
230 || (strcmpi (term, "windows")
231 && __gnuplot_has_feature__ ("windows_figure_position")))
232 ## X11/Windows allows the window to be positioned as well.
233 units = get (0, "units");
234 unwind_protect
235 set (0, "units", "pixels");
236 screen_size = get (0, "screensize")(3:4);
237 unwind_protect_cleanup
238 set (0, "units", units);
239 end_unwind_protect
240 if (all (screen_size > 0))
241 ## For X11/Windows, set the figure positon as well as the size
242 ## gnuplot position is UL, Octave's is LL (same for screen/window)
243 gnuplot_pos(2) = screen_size(2) - gnuplot_pos(2) - gnuplot_size(2);
244 gnuplot_pos = max (gnuplot_pos, 1);
245 size_str = sprintf ("%s position %d,%d", size_str,
246 gnuplot_pos(1), gnuplot_pos(2));
247 endif
248 endif
249 else
250 size_str = "";
251 warning ("gnuplot_set_term: size is zero");
252 endif
253 else
254 ## A specified size take priority over the figure properies.
255 size_str = "";
256 endif
257 else
258 if (isempty (h))
259 disp ("gnuplot_set_term: figure handle is empty");
260 elseif (! isfigure (h))
261 disp ("gnuplot_set_term: not a figure handle");
262 endif
263 title_str = "";
264 size_str = "";
265 endif
266
267 ## Set the gnuplot terminal (type, enhanced, title, options & size).
268 term_str = ["set terminal " term];
269 if (! isempty (enh_str))
270 term_str = [term_str " " enh_str];
271 endif
272 if (! isempty (title_str))
273 term_str = [term_str " " title_str];
274 endif
275 if (isempty (strfind (term, "corel")))
276 if (! isempty (size_str) && new_stream)
277 ## size_str comes after other options to permit specification of
278 ## the canvas size for terminals cdr/corel.
279 term_str = [term_str " " size_str];
280 endif
281 if (nargin > 3 && ischar (opts_str))
282 ## Options must go last.
283 term_str = [term_str " " opts_str];
284 endif
285 else
286 if (nargin > 3 && ischar (opts_str))
287 ## Options must go last.
288 term_str = [term_str " " opts_str];
289 endif
290 if (! isempty (size_str) && new_stream)
291 ## size_str comes after other options to permit specification of
292 ## the canvas size for terminals cdr/corel.
293 term_str = [term_str " " size_str];
294 endif
295 endif
296 if (! __gnuplot_has_feature__ ("has_termoption_dashed"))
297 ## If "set termoption dashed" isn't available add "dashed" option
298 ## to the "set terminal ..." command, if it is supported.
299 if (any (strcmp (term, {"aqua", "cgm", "eepic", "emf", "epslatex", ...
300 "fig", "pcl5", "mp", "next", "openstep", "pdf", ...
301 "pdfcairo", "pngcairo", "postscript", ...
302 "pslatex", "pstext", "svg", "tgif", "x11"})))
303 term_str = [term_str " dashed"];
304 endif
305 endif
306 if (any (strcmp (term, {"aqua", "wxt"})))
307 term_str = [term_str, " ", "dashlength 1"];
308 elseif (any (strcmp (term, {"epslatex", "postscript", "pslatex"})))
309 term_str = [term_str, " ", "dashlength 2"];
310 endif
311
312 ## Work around the gnuplot feature of growing the x11 window and
313 ## flickering window (x11, windows, & wxt) when the mouse and
314 ## multiplot are set in gnuplot.
315 fputs (plot_stream, "unset multiplot;\n");
316 flickering_terms = {"x11", "windows", "wxt", "dumb"};
317 if (! any (strcmp (term, flickering_terms))
318 || have_non_legend_axes (h)
319 || numel (findall (h, "type", "image")) > 0)
320 fprintf (plot_stream, "%s\n", term_str);
321 if (nargin == 5)
322 if (! isempty (file))
323 fprintf (plot_stream, "set output '%s';\n", file);
324 endif
325 endif
326 fputs (plot_stream, "set multiplot;\n");
327 elseif (any (strcmp (term, flickering_terms)))
328 fprintf (plot_stream, "%s\n", term_str);
329 if (nargin == 5)
330 if (! isempty (file))
331 fprintf (plot_stream, "set output '%s';\n", file);
332 endif
333 endif
334 endif
335 if (__gnuplot_has_feature__ ("has_termoption_dashed"))
336 fprintf (plot_stream, "set termoption dashed\n")
337 endif
338 else
339 ## gnuplot will pick up the GNUTERM environment variable itself
340 ## so no need to set the terminal type if not also setting the
341 ## figure title, enhanced mode, or position.
342 endif
343
344 endfunction
345
346 function term = gnuplot_default_term (plot_stream)
347 term = lower (getenv ("GNUTERM"));
348 ## If not specified, guess the terminal type.
349 if (isempty (term) || ! __gnuplot_has_terminal__ (term, plot_stream))
350 if (isguirunning () && __gnuplot_has_terminal__ ("qt", plot_stream))
351 term = "qt";
352 elseif (ismac ())
353 term = "aqua";
354 elseif (! isunix ())
355 term = "windows";
356 elseif (! isempty (getenv ("DISPLAY")))
357 term = "x11";
358 else
359 term = "dumb";
360 endif
361 endif
362 endfunction
363
364 function [term, opts] = gnuplot_trim_term (string)
365 ## Extract the terminal type and terminal options (from print.m)
366 string = strtrim (string);
367 [term, opts] = strtok (string, ' ');
368 if (! isempty (opts))
369 opts(1) = ""; # trim extra space from strtok
370 endif
371 endfunction
372
373 function have_enhanced = gnuplot_is_enhanced_term (plot_stream, term)
374 ## Don't include pstex, pslatex or epslatex here as the TeX commands
375 ## should not be interpreted in that case.
376 persistent enhanced_terminals = {"aqua", "canvas", "dumb", "emf", "gif", ...
377 "jpeg", "pdf", "pdfcairo", "pm", "png", ...
378 "pngcairo", "postscript", "qt", "svg", ...
379 "windows", "wxt", "x11"};
380
381 if (nargin < 2)
382 ## Determine the default gnuplot terminal.
383 term = gnuplot_default_term (plot_stream);
384 endif
385 have_enhanced = any (strcmp (term, enhanced_terminals));
386 endfunction
387
388 function ret = output_to_screen (term)
389 ret = any (strcmpi (term,
390 {"aqua", "dumb", "pm", "qt", "windows", "wxt", "x11"}));
391 endfunction
392
393 function retval = have_non_legend_axes (h)
394 retval = false;
395 all_axes = findall (h, "type", "axes");
396 if (! isempty (all_axes))
397 n_all_axes = numel (all_axes);
398 all_axes_tags = get (all_axes, "tag");
399 legend_axes = strcmp (all_axes_tags, "legend");
400 if (! isempty (legend_axes))
401 n_legend_axes = sum (legend_axes);
402 retval = (n_all_axes - n_legend_axes) > 1;
403 endif
404 endif
405 endfunction
406
407
408 ## No test needed for internal helper function.
409 %!assert (1)
410