# HG changeset patch # User jwe # Date 1159972677 0 # Node ID e282b629db6ff3ecfdd544985bbec21b71bbfefa # Parent 3dbbbec85190e8c8975467afd71712ae379b61ec [project @ 2006-10-04 14:37:56 by jwe] diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,8 @@ +2006-10-04 John W. Eaton + + * plot/__clear_plot__.m: New function. + * plot/__setup_plot__.m: Use __clear_plot__. + 2006-10-03 Søren Hauberg * pkg/pkg.m: Avoid calling addpath with no args. diff --git a/scripts/plot/__clear_plot__.m b/scripts/plot/__clear_plot__.m new file mode 100644 --- /dev/null +++ b/scripts/plot/__clear_plot__.m @@ -0,0 +1,42 @@ +## Copyright (C) 2006 John W. Eaton +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +function __clear_plot__ (cmd, sep, clear_data) + + __plot_globals__ + + if (nargin < 3) + clear_data = true; + if (nargin < 2) + sep = ""; + if (nargin < 1) + cmd = ""; + endif + endif + endif + + __plot_command__{__current_figure__}{__multiplot_xi__,__multiplot_yi__} = cmd; + __plot_command_sep__ = sep; + + if (clear_data) + __plot_data__{__current_figure__}{__multiplot_xi__,__multiplot_yi__} = []; + __plot_data_offset__{__current_figure__}(__multiplot_xi__,__multiplot_yi__) = 1; + endif + +endfunction diff --git a/scripts/plot/__setup_plot__.m b/scripts/plot/__setup_plot__.m --- a/scripts/plot/__setup_plot__.m +++ b/scripts/plot/__setup_plot__.m @@ -22,16 +22,20 @@ __plot_globals__ if (ishold ()) - if (isempty (__plot_command__{__current_figure__}{__multiplot_xi__,__multiplot_yi__})) - __plot_command__{__current_figure__}{__multiplot_xi__,__multiplot_yi__} = plotcmd; - __plot_command_sep__ = ""; + cmd = __plot_command__{__current_figure__}{__multiplot_xi__,__multiplot_yi__}; + if (isempty (cmd)) + cmd = plotcmd; + sep = ""; else - __plot_command_sep__ = ",\\\n"; + sep = ",\\\n"; endif + clear_data = false; else - __plot_command__{__current_figure__}{__multiplot_xi__,__multiplot_yi__} = plotcmd; - __plot_command_sep__ = ""; - __plot_data__{__current_figure__}{__multiplot_xi__,__multiplot_yi__} = []; - __plot_data_offset__{__current_figure__}(__multiplot_xi__,__multiplot_yi__) = 1; + cmd = plotcmd; + sep = ""; + clear_data = true; endif + + __clear_plot__ (cmd, sep, clear_data); + endfunction diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2006-10-04 John W. Eaton + + * DLD-FUNCTIONS/__gnuplot_raw__.l (Fclearplot): + Also call __clear_plot__. + 2006-10-03 John W. Eaton * DLD-FUNCTIONS/luinc.cc (Fluinc): Avoid crash if SparseLU or diff --git a/src/DLD-FUNCTIONS/__gnuplot_raw__.l b/src/DLD-FUNCTIONS/__gnuplot_raw__.l --- a/src/DLD-FUNCTIONS/__gnuplot_raw__.l +++ b/src/DLD-FUNCTIONS/__gnuplot_raw__.l @@ -1601,8 +1601,10 @@ octave_value_list args; args(0) = "off"; + feval ("hold", args); - feval ("hold", args); + args.resize (0); + feval ("__clear_plot__", args); return octave_value_list (); }