# HG changeset patch # User Ben Abbott # Date 1227547623 18000 # Node ID 9f34f7636fe0a97b8ff40d6229e8c6c859ca67be # Parent 39b9f7dfbf4ac3388d6956563cc3aec0812a0169 legend.m: Correct ording of legend labels. diff -r 39b9f7dfbf4a -r 9f34f7636fe0 scripts/ChangeLog --- a/scripts/ChangeLog Mon Nov 24 11:05:25 2008 +0100 +++ b/scripts/ChangeLog Mon Nov 24 12:27:03 2008 -0500 @@ -1,3 +1,7 @@ +2008-11-24 Ben Abbott + + * plot/legend.m: Correct ording of legend labels. + 2008-11-21 Radek Salac * sparse/cgs.m, sparse/treelayout.m: New functions. diff -r 39b9f7dfbf4a -r 9f34f7636fe0 scripts/plot/legend.m --- a/scripts/plot/legend.m Mon Nov 24 11:05:25 2008 +0100 +++ b/scripts/plot/legend.m Mon Nov 24 12:27:03 2008 -0500 @@ -165,11 +165,13 @@ nargs = numel (varargin); endif elseif (iscellstr (arg)) - varargin = arg; + varargin = fliplr (arg); nargs = numel (varargin); else error ("legend: expecting argument to be a character string"); endif + else + varargin(1:nargs) = fliplr (varargin(1:nargs)); endif if (nargs > 0) @@ -231,6 +233,12 @@ %!demo %! close all; +%! plot(1:10, 1:10, 1:10, fliplr(1:10)); +%! title("incline is blue and decline is green"); +%! legend({"I'm blue", "I'm green"}, "location", "east") + +%!demo +%! close all; %! plot(1:10, 1:10); %! title("a very long label can sometimes cause problems"); %! legend({"hello world"}, "location", "northeastoutside")