# HG changeset patch # User jwe # Date 1109014883 0 # Node ID b111ca4715c6cd8a17c90e1cfdd462905bdef9ab # Parent b142b5a0d6bef81d1b102ea005e8177dddd61784 [project @ 2005-02-21 19:41:23 by jwe] diff -r b142b5a0d6be -r b111ca4715c6 doc/interpreter/plot.txi --- a/doc/interpreter/plot.txi Mon Feb 21 16:50:00 2005 +0000 +++ b/doc/interpreter/plot.txi Mon Feb 21 19:41:23 2005 +0000 @@ -341,8 +341,6 @@ any arguments. @end deffn -@DOCSTRING(automatic_replot) - Note that NaN values in the plot data are automatically omitted, and Inf values are converted to a very large value before calling gnuplot. diff -r b142b5a0d6be -r b111ca4715c6 scripts/ChangeLog --- a/scripts/ChangeLog Mon Feb 21 16:50:00 2005 +0000 +++ b/scripts/ChangeLog Mon Feb 21 19:41:23 2005 +0000 @@ -1,3 +1,8 @@ +2005-02-21 John W. Eaton + + * plot/grid.m, plot/plot_border.m, plot/title.m, plot/top_title.m, + plot/__axis_label__.m: Issue replot command. + 2005-02-09 John W. Eaton * polynomial/polyderiv.m: Force P to be a row vector. diff -r b142b5a0d6be -r b111ca4715c6 scripts/plot/__axis_label__.m --- a/scripts/plot/__axis_label__.m Mon Feb 21 16:50:00 2005 +0000 +++ b/scripts/plot/__axis_label__.m Mon Feb 21 19:41:23 2005 +0000 @@ -32,6 +32,9 @@ if (isstr (text)) eval (sprintf ("gset %s \"%s\"", caller, undo_string_escapes (undo_string_escapes (text)))); + if (automatic_replot) + replot + endif else error ("%s: text must be a string", caller); endif diff -r b142b5a0d6be -r b111ca4715c6 scripts/plot/axis.m --- a/scripts/plot/axis.m Mon Feb 21 16:50:00 2005 +0000 +++ b/scripts/plot/axis.m Mon Feb 21 19:41:23 2005 +0000 @@ -26,11 +26,6 @@ ## axis. The third and fourth specify the limits for the y axis, and the ## fifth and sixth specify the limits for the z axis. ## -## If your plot is already drawn, then you need to use @code{replot} before -## the new axis limits will take effect. You can get this to happen -## automatically by setting the built-in variable @code{automatic_replot} -## to a nonzero value. -## ## Without any arguments, @code{axis} turns autoscaling on. ## ## With one output argument, @code{x=axis} returns the current axes @@ -174,7 +169,7 @@ gset yrange [] writeback; gset zrange [] writeback; ## XXX FIXME XXX if writeback were set in plot, no need to replot here. - replot; + replot gset noautoscale x; gset noautoscale y; gset noautoscale z; @@ -268,6 +263,8 @@ if (nargin > 1) axis (varargin{:}); + elseif (automatic_replot) + replot endif endfunction diff -r b142b5a0d6be -r b111ca4715c6 scripts/plot/grid.m --- a/scripts/plot/grid.m Mon Feb 21 16:50:00 2005 +0000 +++ b/scripts/plot/grid.m Mon Feb 21 19:41:23 2005 +0000 @@ -35,16 +35,21 @@ usage_msg = "grid (\"on\" | \"off\")"; + do_replot = false; + if (nargin == 0) gset grid; + do_replot = true; elseif (nargin == 1) if (isstr (x)) if (strcmp ("off", x)) gset nogrid; + do_replot = true; elseif (strcmp ("on", x)) gset grid; + do_replot = true; else - usage (usage_msg); + usage (usage_msg); endif else error ("grid: argument must be a string"); @@ -53,4 +58,8 @@ usage (usage_msg); endif + if (do_replot && automatic_replot) + replot + endif + endfunction diff -r b142b5a0d6be -r b111ca4715c6 scripts/plot/plot_border.m --- a/scripts/plot/plot_border.m Mon Feb 21 16:50:00 2005 +0000 +++ b/scripts/plot/plot_border.m Mon Feb 21 19:41:23 2005 +0000 @@ -110,4 +110,8 @@ eval (sprintf ("gset border %d", border)); endif + if (automatic_replot) + replot + endif + endfunction diff -r b142b5a0d6be -r b111ca4715c6 scripts/plot/title.m --- a/scripts/plot/title.m Mon Feb 21 16:50:00 2005 +0000 +++ b/scripts/plot/title.m Mon Feb 21 19:41:23 2005 +0000 @@ -19,8 +19,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} title (@var{string}) -## Specify a title for a plot. If you already have a plot displayed, use -## the command @code{replot} to redisplay it with the new title. +## Specify a title for a plot. ## @end deftypefn ## ## @seealso{plot, semilogx, semilogy, loglog, polar, mesh, contour, @@ -37,6 +36,9 @@ if (isstr (text)) eval (sprintf ("gset title \"%s\"", undo_string_escapes (undo_string_escapes (text)))); + if (automatic_replot) + replot + endif else error ("title: text must be a string"); endif diff -r b142b5a0d6be -r b111ca4715c6 scripts/plot/top_title.m --- a/scripts/plot/top_title.m Mon Feb 21 16:50:00 2005 +0000 +++ b/scripts/plot/top_title.m Mon Feb 21 19:41:23 2005 +0000 @@ -38,6 +38,9 @@ gset title; eval (sprintf ("gset top_title \"%s\"", undo_string_escapes (undo_string_escapes (text)))); + if (automatic_replot) + replot + endif else error ("error: top_title: text must be a string"); endif diff -r b142b5a0d6be -r b111ca4715c6 src/ChangeLog --- a/src/ChangeLog Mon Feb 21 16:50:00 2005 +0000 +++ b/src/ChangeLog Mon Feb 21 19:41:23 2005 +0000 @@ -1,3 +1,10 @@ +2005-02-21 John W. Eaton + + * DLD-FUNCTIONS/gplot.l (send_to_plot_stream): + Replot with no previous plot is a no-op. + (makeplot): Likewise. + (Vautomatic_replot): Don't use this variable in low-level functions. + 2005-02-18 John W. Eaton * Makefile.in (oct-gperf.h): Remove -E from list of gperf options. diff -r b142b5a0d6be -r b111ca4715c6 src/DLD-FUNCTIONS/gplot.l --- a/src/DLD-FUNCTIONS/gplot.l Mon Feb 21 16:50:00 2005 +0000 +++ b/src/DLD-FUNCTIONS/gplot.l Mon Feb 21 19:41:23 2005 +0000 @@ -432,26 +432,13 @@ } int replot_len = Vgnuplot_command_replot.length (); - int splot_len = Vgnuplot_command_splot.length (); - int plot_len = Vgnuplot_command_plot.length (); bool is_replot = (Vgnuplot_command_replot == cmd.substr (0, replot_len)); - bool is_splot = (Vgnuplot_command_splot == cmd.substr (0, splot_len)); - bool is_plot = (Vgnuplot_command_plot == cmd.substr (0, plot_len)); - if (plot_line_count == 0 && is_replot) - error ("replot: no previous plot"); - else + if (! (plot_line_count == 0 && is_replot)) { *plot_stream << cmd; - if (! (is_replot || is_splot || is_plot) - && plot_line_count > 0 - && Vautomatic_replot) - { - *plot_stream << Vgnuplot_command_replot << Vgnuplot_command_end; - } - plot_stream->flush (); } @@ -947,7 +934,7 @@ } if (plottok_or_end_p (tok)) - throw gpt_parse_error ("must have something to plot"); + return 1; else { std::string file; @@ -967,7 +954,7 @@ plot_expr_str += std::string (yytext) + " "; plot_expr_str += read_until (plottok_or_end_p, tok); - int status; + int status = 0; octave_value tmp_data = eval_string (plot_expr_str, true, status); @@ -983,7 +970,7 @@ file = file_ops::tilde_expand (tmp_data.string_value ()); // XXX FIXME XXX -- perhaps should check if the file exists? outstr += file + " "; - } + } else { switch (ndim) @@ -1000,14 +987,14 @@ default: gripe_2_or_3_dim_plot (); break; - } + } if (file.length () > 0) { mark_for_deletion (file); outstr += "'" + file + "' "; } - } + } } }