Mercurial > hg > octave-nkf
diff scripts/plot/gnuplot_drawnow.m @ 9107:d0d507cbd123
Improvements to printing functionality.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Fri, 10 Apr 2009 12:11:14 -0400 |
parents | 8651fcc89556 |
children | 4bb94a71913b |
line wrap: on
line diff
--- a/scripts/plot/gnuplot_drawnow.m +++ b/scripts/plot/gnuplot_drawnow.m @@ -41,8 +41,7 @@ printing = ! output_to_screen (gnuplot_trim_term (term)); default_plot_stream = get (h, "__plot_stream__"); unwind_protect - plot_stream = open_gnuplot_stream (2, []); - set (h, "__plot_stream__", plot_stream); + plot_stream = open_gnuplot_stream (2, h); if (__gnuplot_has_feature__ ("variable_GPVAL_TERMINALS")) available_terminals = __gnuplot_get_var__ (plot_stream, "GPVAL_TERMINALS"); available_terminals = regexp (available_terminals, "\\b\\w+\\b", "match"); @@ -191,7 +190,7 @@ ## Get size of the printed plot in inches. gnuplot_size = get_papersize (h); if (term_units_are_pixels (term)) - ## Convert to inches using the property set by print(). + ## Convert to inches using the property set by print(). gnuplot_size = gnuplot_size * get (h, "__pixels_per_inch__"); else ## Implicit margins are in units of "inches" @@ -277,16 +276,16 @@ if (! isempty (title_str)) term_str = sprintf ("%s %s", term_str, title_str); endif + if (nargin > 3 && ischar (opts_str)) + ## Options must go last. + term_str = sprintf ("%s %s", term_str, opts_str); + endif if (! isempty (size_str) && new_stream) ## size_str goes last to permit specification of canvas size ## for terminals cdr/corel. term_str = sprintf ("%s %s", term_str, size_str); endif - if (nargin > 3 && ischar (opts_str)) - ## Options must go last. - term_str = sprintf ("%s %s", term_str, opts_str); - endif - fprintf (plot_stream, sprintf ("%s;\n", term_str)); + fprintf (plot_stream, "%s\n", term_str); else ## gnuplot will pick up the GNUTERM environment variable itself ## so no need to set the terminal type if not also setting the @@ -356,7 +355,7 @@ endfunction function ret = term_units_are_pixels (term) - ret = any (strcmpi ({"png", "jpeg", "gif", "pbm", "svg"}, term)); + ret = any (strcmpi ({"emf", "gif", "jpeg", "pbm", "png", "svg"}, term)); endfunction function [fig_size, fig_pos] = get_figsize (h)