comparison scripts/plot/gnuplot_drawnow.m @ 9632:40acd13920e3

gnuplot_drawnow.m: Avoid flickering plot windows.
author Ben Abbott <bpabbott@mac.com>
date Wed, 09 Sep 2009 19:41:29 -0400
parents c60a9e1a0372
children 4634a0e9ea1b
comparison
equal deleted inserted replaced
9631:00958d0c4e3c 9632:40acd13920e3
286 if (! isempty (size_str) && new_stream) 286 if (! isempty (size_str) && new_stream)
287 ## size_str comes after other options to permit specification of 287 ## size_str comes after other options to permit specification of
288 ## the canvas size for terminals cdr/corel. 288 ## the canvas size for terminals cdr/corel.
289 term_str = sprintf ("%s %s", term_str, size_str); 289 term_str = sprintf ("%s %s", term_str, size_str);
290 endif 290 endif
291 ## Work around the gnuplot feature of growing the x11 window when 291 ## Work around the gnuplot feature of growing the x11 window and
292 ## the mouse and multiplot are set. 292 ## flickering window (x11, windows, & wxt) when the mouse and
293 ## multiplot are set in gnuplot.
293 fputs (plot_stream, "unset multiplot;\n"); 294 fputs (plot_stream, "unset multiplot;\n");
294 if (! strcmp (term, "x11") 295 flickering_terms = {"x11", "windows", "wxt"};
296 if (! any (strcmp (term, flickering_terms))
295 || numel (findall (h, "type", "axes")) > 1 297 || numel (findall (h, "type", "axes")) > 1
296 || numel (findall (h, "type", "image")) > 0) 298 || numel (findall (h, "type", "image")) > 0)
297 fprintf (plot_stream, "%s\n", term_str); 299 fprintf (plot_stream, "%s\n", term_str);
298 if (nargin == 5) 300 if (nargin == 5)
299 if (! isempty (file)) 301 if (! isempty (file))
300 fprintf (plot_stream, "set output '%s';\n", file); 302 fprintf (plot_stream, "set output '%s';\n", file);
301 endif 303 endif
302 endif 304 endif
303 fputs (plot_stream, "set multiplot;\n"); 305 fputs (plot_stream, "set multiplot;\n");
304 elseif (strcmp (term, "x11")) 306 elseif (any (strcmp (term, flickering_terms)))
305 fprintf (plot_stream, "%s\n", term_str); 307 fprintf (plot_stream, "%s\n", term_str);
306 if (nargin == 5) 308 if (nargin == 5)
307 if (! isempty (file)) 309 if (! isempty (file))
308 fprintf (plot_stream, "set output '%s';\n", file); 310 fprintf (plot_stream, "set output '%s';\n", file);
309 endif 311 endif