Mercurial > hg > octave-lyh
view scripts/plot/hold.m @ 7421:1c7b3e1fda19
[project @ 2008-01-25 21:00:42 by dbateman]
author | dbateman |
---|---|
date | Fri, 25 Jan 2008 21:02:26 +0000 |
parents | a1dbe9d80eee |
children | 85c5c1d55820 965bb17961f0 |
line wrap: on
line source
## Copyright (C) 2005, 2006, 2007 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 3 of the License, 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, see ## <http://www.gnu.org/licenses/>. ## -*- texinfo -*- ## @deftypefn {Function File} {} hold @var{args} ## Tell Octave to `hold' the current data on the plot when executing ## subsequent plotting commands. This allows you to execute a series of ## plot commands and have all the lines end up on the same figure. The ## default is for each new plot command to clear the plot device first. ## For example, the command ## ## @example ## hold on ## @end example ## ## @noindent ## turns the hold state on. An argument of @code{"off"} turns the hold ## state off, and @code{hold} with no arguments toggles the current hold ## state. ## @end deftypefn ## PKG_ADD: mark_as_command hold function hold (varargin) [h, varargin] = __plt_get_axis_arg__ ("hold", varargin{:}); hold_state = get (h, "nextplot"); nargs = numel (varargin); if (nargs == 0) if (strcmp (hold_state, "add")) hold_state = "replace"; else hold_state = "add"; endif elseif (nargs == 1) state = varargin{1}; if (ischar (state)) if (strcmp ("off", state)) hold_state = "replace"; elseif (strcmp ("on", state)) hold_state = "add"; else print_usage (); endif endif else print_usage (); endif set (h, "nextplot", hold_state); endfunction