# HG changeset patch # User Ben Abbott # Date 1336007680 14400 # Node ID fd6e50e2eee6499df77eb16572b4ab3417da2fc9 # Parent c38a253723d31d6a7611ebd7616bca59017ffeed legend() should accept labels being specified as both cellstrs and char. legend.m: Accept labels as both cell strings and character strings. diff -r c38a253723d3 -r fd6e50e2eee6 scripts/plot/legend.m --- a/scripts/plot/legend.m Tue May 01 19:38:51 2012 -0400 +++ b/scripts/plot/legend.m Wed May 02 21:14:40 2012 -0400 @@ -272,6 +272,9 @@ else error ("legend: expecting argument to be a character string"); endif + elseif (nargs > 1 && iscellstr (varargin{1})) + varargin = {varargin{1}{:}, varargin{2:end}}; + nargs = numel (varargin); endif if (strcmp (show, "off")) @@ -969,6 +972,11 @@ endfunction %!demo +%! plot (rand (2)) +%! legend ({'foo'}, 'bar', 'boxoff') +%! title ('legend() should warn about an extra label') + +%!demo %! plot (rand (2,2)) ; %! h = legend ('a', 'b') ; %! legend ('right') ;