Mercurial > hg > octave-lyh
changeset 6029:e282b629db6f
[project @ 2006-10-04 14:37:56 by jwe]
author | jwe |
---|---|
date | Wed, 04 Oct 2006 14:37:57 +0000 |
parents | 3dbbbec85190 |
children | 004037def470 |
files | scripts/ChangeLog scripts/plot/__clear_plot__.m scripts/plot/__setup_plot__.m src/ChangeLog src/DLD-FUNCTIONS/__gnuplot_raw__.l |
diffstat | 5 files changed, 67 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,8 @@ +2006-10-04 John W. Eaton <jwe@octave.org> + + * plot/__clear_plot__.m: New function. + * plot/__setup_plot__.m: Use __clear_plot__. + 2006-10-03 Søren Hauberg <soren@hauberg.org> * pkg/pkg.m: Avoid calling addpath with no args.
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
--- 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