Mercurial > hg > octave-lyh
diff scripts/plot/private/__plt__.m @ 17396:e04847bbcfdf
Squeeze Nd > 2 plot vectors.
* scripts/plot/__plt__.m: Squeeze input plot vectors when ndims>2.
Throw error if there are more than 2 non-singleton dimensions.
* scripts/plot/plot.m: Modify doc-string. Add demos.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Sat, 07 Sep 2013 12:21:38 -0400 |
parents | 53f1d5bb58bc |
children | 1dfc3abb0f0d |
line wrap: on
line diff
--- a/scripts/plot/private/__plt__.m +++ b/scripts/plot/private/__plt__.m @@ -25,6 +25,7 @@ function retval = __plt__ (caller, h, varargin) + persistent warned_callers = {}; nargs = nargin - 2; if (nargs > 0) @@ -72,6 +73,19 @@ next_arg = varargin{k++}; endif + if (isnumeric (next_arg) && ndims (next_arg) > 2 + && any (size (next_arg) == 1)) + next_arg = squeeze (next_arg); + if (! any (strcmp (caller, warned_callers)) && ndims (next_arg) < 3) + warning (["%s: N-d inputs have been squeezed to less than " ... + "three dimensions"], caller) + warned_callers(end+1) = caller; + endif + endif + if (isnumeric (next_arg) && ndims (next_arg) > 2) + error ("%s: plot arrays must have less than 2 dimensions", caller) + endif + nargs--; if (ischar (next_arg) || iscellstr (next_arg))