Mercurial > octave
changeset 31975:72d005398818
hold.m: Print current hold state to Command Window when toggling state (bug #63923)
* NEWS.9.md: Announce improvement.
* hold.m: When called with no input arguments (toggling the hold state), print
the resulting state to the Command Window.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 06 Apr 2023 16:34:06 -0700 |
parents | d33f168bdc92 |
children | e6b24d0d485c |
files | etc/NEWS.9.md scripts/plot/util/hold.m |
diffstat | 2 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/etc/NEWS.9.md Thu Apr 06 18:28:57 2023 -0400 +++ b/etc/NEWS.9.md Thu Apr 06 16:34:06 2023 -0700 @@ -23,10 +23,14 @@ ### Graphics backend -* the `set` function now accepts any combination of name/value pairs, +* The `set` function now accepts any combination of name/value pairs, cell array of names / cell array of values, or property structures. This change is Matlab-compatible. +* When the `hold` function is used without arguments to toggle the current +state the resulting value is now displayed in the Command Window for +informational purposes. + ### Matlab compatibility - Overhauled `mean`, `median`, `var`, and `std` functions have been imported
--- a/scripts/plot/util/hold.m Thu Apr 06 18:28:57 2023 -0400 +++ b/scripts/plot/util/hold.m Thu Apr 06 16:34:06 2023 -0700 @@ -58,7 +58,9 @@ function hold (varargin) + have_axes_arg = false; if (nargin > 0 && isscalar (varargin{1}) && isaxes (varargin{1})) + have_axes_arg = true; hax = varargin{1}; varargin(1) = []; nargs = numel (varargin); @@ -74,6 +76,9 @@ hold_all = false; if (nargs == 0) turn_hold_off = ishold (hax); + state_str = ifelse (turn_hold_off, "off", "on"); + axes_str = ifelse (have_axes_arg, "specified", "current"); + printf ("hold is now %s for %s axes\n", state_str, axes_str); elseif (nargs == 1) state = tolower (varargin{1}); switch (state)