Mercurial > hg > octave-lyh
comparison scripts/plot/gnuplot_drawnow.m @ 9478:7e1e90837fef
Avoid the flickering x11 window seen with rapid gnuplot updates.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Sun, 02 Aug 2009 16:52:12 -0400 |
parents | 5af462716bff |
children | c60a9e1a0372 |
comparison
equal
deleted
inserted
replaced
9477:4d3d90253e8a | 9478:7e1e90837fef |
---|---|
266 endif | 266 endif |
267 title_str = ""; | 267 title_str = ""; |
268 size_str = ""; | 268 size_str = ""; |
269 endif | 269 endif |
270 | 270 |
271 ## Set the gnuplot terminal (type, enhanced?, title, & size). | 271 ## Set the gnuplot terminal (type, enhanced, title, options & size). |
272 if (! isempty (term)) | 272 term_str = sprintf ("set terminal %s", term); |
273 term_str = sprintf ("set terminal %s", term); | 273 if (! isempty (enh_str)) |
274 if (any (strncmpi (term, {"x11", "wxt"}, 3)) && new_stream | 274 term_str = sprintf ("%s %s", term_str, enh_str); |
275 && __gnuplot_has_feature__ ("x11_figure_position")) | 275 endif |
276 ## The "close" is added to allow the figure position property | 276 if (! isempty (title_str)) |
277 ## to remain active. | 277 term_str = sprintf ("%s %s", term_str, title_str); |
278 term_str = sprintf ("%s close", term_str); | 278 endif |
279 endif | 279 if (nargin > 3 && ischar (opts_str)) |
280 if (! isempty (enh_str)) | 280 ## Options must go last. |
281 term_str = sprintf ("%s %s", term_str, enh_str); | 281 term_str = sprintf ("%s %s", term_str, opts_str); |
282 endif | 282 endif |
283 if (! isempty (title_str)) | 283 if (! isempty (size_str) && new_stream) |
284 term_str = sprintf ("%s %s", term_str, title_str); | 284 ## size_str comes after other options to permit specification of |
285 endif | 285 ## the canvas size for terminals cdr/corel. |
286 if (nargin > 3 && ischar (opts_str)) | 286 term_str = sprintf ("%s %s", term_str, size_str); |
287 ## Options must go last. | 287 endif |
288 term_str = sprintf ("%s %s", term_str, opts_str); | 288 ## Work around the gnuplot feature of growing the x11 window when |
289 endif | 289 ## the mouse and multiplot are set. |
290 if (! isempty (size_str) && new_stream) | 290 fputs (plot_stream, "unset multiplot;\n"); |
291 ## size_str goes last to permit specification of canvas size | 291 if (! strcmp (term, "x11") |
292 ## for terminals cdr/corel. | 292 || numel (findall (h, "type", "axes")) > 1 |
293 term_str = sprintf ("%s %s", term_str, size_str); | 293 || numel (findall (h, "type", "image")) > 0) |
294 endif | |
295 fprintf (plot_stream, "%s\n", term_str); | 294 fprintf (plot_stream, "%s\n", term_str); |
296 else | 295 if (nargin == 5) |
297 ## gnuplot will pick up the GNUTERM environment variable itself | 296 if (! isempty (file)) |
298 ## so no need to set the terminal type if not also setting the | 297 fprintf (plot_stream, "set output '%s';\n", file); |
299 ## figure title, enhanced mode, or position. | 298 endif |
300 endif | 299 endif |
301 endif | 300 fputs (plot_stream, "set multiplot;\n"); |
302 | 301 elseif (strcmp (term, "x11")) |
303 if (nargin == 5) | 302 fprintf (plot_stream, "%s\n", term_str); |
304 if (! isempty (file)) | 303 if (nargin == 5) |
305 fprintf (plot_stream, "set output '%s';\n", file); | 304 if (! isempty (file)) |
306 endif | 305 fprintf (plot_stream, "set output '%s';\n", file); |
307 endif | 306 endif |
307 endif | |
308 endif | |
309 else | |
310 ## gnuplot will pick up the GNUTERM environment variable itself | |
311 ## so no need to set the terminal type if not also setting the | |
312 ## figure title, enhanced mode, or position. | |
313 endif | |
314 | |
308 | 315 |
309 endfunction | 316 endfunction |
310 | 317 |
311 function term = gnuplot_default_term () | 318 function term = gnuplot_default_term () |
312 term = getenv ("GNUTERM"); | 319 term = getenv ("GNUTERM"); |