Mercurial > hg > octave-lyh
changeset 9002:5cc15e4b4e5c
gnuplot_drawnow.m: Verify the gnuplot terminal is supported.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Sat, 21 Mar 2009 13:04:43 -0400 |
parents | b3268a0458f2 |
children | 0631d397fbe0 |
files | scripts/ChangeLog scripts/plot/gnuplot_drawnow.m |
diffstat | 2 files changed, 15 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,5 +1,6 @@ 2009-03-21 Ben Abbott <bpabbott@mac.com> + * plot/gnuplot_drawnow.m: Verify the gnuplot terminal is supported. * plot/__gnuplot_get_var__.m: Add function to get gnuplot variables. * plot/print.m: Restore the behavior for option -S<num>,<num>.
--- a/scripts/plot/gnuplot_drawnow.m +++ b/scripts/plot/gnuplot_drawnow.m @@ -40,13 +40,20 @@ fid = []; printing = ! output_to_screen (gnuplot_trim_term (term)); unwind_protect - plot_stream = open_gnuplot_stream (1, []); - [enhanced, implicit_margin] = gnuplot_set_term (plot_stream (1), true, h, term, file); - __go_draw_figure__ (h, plot_stream, enhanced, mono, printing, implicit_margin); - if (nargin == 5) - fid = fopen (debug_file, "wb"); - enhanced = gnuplot_set_term (fid, true, h, term, file); - __go_draw_figure__ (h, fid, enhanced, mono, printing, implicit_margin); + plot_stream = open_gnuplot_stream (2, []); + available_terminals = __gnuplot_get_var__ (plot_stream, "GPVAL_TERMINALS"); + available_terminals = regexp (available_terminals, "\\b\\w+\\b", "match"); + if (any (strcmpi (available_terminals, gnuplot_trim_term (term)))) + [enhanced, implicit_margin] = gnuplot_set_term (plot_stream (1), true, h, term, file); + __go_draw_figure__ (h, plot_stream, enhanced, mono, printing, implicit_margin); + if (nargin == 5) + fid = fopen (debug_file, "wb"); + [enhanced, implicit_margin] = gnuplot_set_term (fid, true, h, term, file); + __go_draw_figure__ (h, fid, enhanced, mono, printing, implicit_margin); + endif + else + error ("gnuplot_drawnow: the gnuplot terminal, \"%s\", is not available.", + gnuplot_trim_term (term)) endif unwind_protect_cleanup if (! isempty (plot_stream))