comparison scripts/plot/gnuplot_drawnow.m @ 12090:f12b581a1572 release-3-2-x

gnuplot_drawnow.m: Avoid flickering plot windows.
author Ben Abbott <bpabbott@mac.com>
date Mon, 14 Sep 2009 07:55:15 +0200
parents fe30458b1de8
children 52d8ad5d28d6
comparison
equal deleted inserted replaced
12089:f859b61b8bf4 12090:f12b581a1572
284 if (! isempty (size_str) && new_stream) 284 if (! isempty (size_str) && new_stream)
285 ## size_str comes after other options to permit specification of 285 ## size_str comes after other options to permit specification of
286 ## the canvas size for terminals cdr/corel. 286 ## the canvas size for terminals cdr/corel.
287 term_str = sprintf ("%s %s", term_str, size_str); 287 term_str = sprintf ("%s %s", term_str, size_str);
288 endif 288 endif
289 ## Work around the gnuplot feature of growing the x11 window when 289 ## Work around the gnuplot feature of growing the x11 window and
290 ## the mouse and multiplot are set. 290 ## flickering window (x11, windows, & wxt) when the mouse and
291 ## multiplot are set in gnuplot.
291 fputs (plot_stream, "unset multiplot;\n"); 292 fputs (plot_stream, "unset multiplot;\n");
292 if (! strcmp (term, "x11") 293 flickering_terms = {"x11", "windows", "wxt"};
294 if (! any (strcmp (term, flickering_terms))
293 || numel (findall (h, "type", "axes")) > 1 295 || numel (findall (h, "type", "axes")) > 1
294 || numel (findall (h, "type", "image")) > 0) 296 || numel (findall (h, "type", "image")) > 0)
295 fprintf (plot_stream, "%s\n", term_str); 297 fprintf (plot_stream, "%s\n", term_str);
296 if (nargin == 5) 298 if (nargin == 5)
297 if (! isempty (file)) 299 if (! isempty (file))
298 fprintf (plot_stream, "set output '%s';\n", file); 300 fprintf (plot_stream, "set output '%s';\n", file);
299 endif 301 endif
300 endif 302 endif
301 fputs (plot_stream, "set multiplot;\n"); 303 fputs (plot_stream, "set multiplot;\n");
302 elseif (strcmp (term, "x11")) 304 elseif (any (strcmp (term, flickering_terms)))
303 fprintf (plot_stream, "%s\n", term_str); 305 fprintf (plot_stream, "%s\n", term_str);
304 if (nargin == 5) 306 if (nargin == 5)
305 if (! isempty (file)) 307 if (! isempty (file))
306 fprintf (plot_stream, "set output '%s';\n", file); 308 fprintf (plot_stream, "set output '%s';\n", file);
307 endif 309 endif