Mercurial > hg > octave-lyh
changeset 14207:57e3490094e1
Fix order of legend entries for plotyy. Bug # 35314.
* legend.m: Maintain the proper order of children for plotyy. Add demos.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Tue, 17 Jan 2012 07:30:06 -0500 |
parents | df695e37d404 |
children | 3f4cae8cb9fc |
files | scripts/plot/legend.m |
diffstat | 1 files changed, 22 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/legend.m +++ b/scripts/plot/legend.m @@ -147,7 +147,7 @@ if (isscalar (kids)) kids = get(kids, "children")(:); else - kids = [get(kids, "children"){:}](:); + kids = flipud ([get(kids, "children"){:}](:)); endif endif nargs = numel (varargin); @@ -1159,3 +1159,24 @@ %! h = legend ("Hello_World", "foo^bar"); %! set (h, "interpreter", "none") +%!demo +%! x = 0:10; +%! y1 = rand (size (x)); +%! y2 = rand (size (x)); +%! [ax, h1, h2] = plotyy (x, y1, x, y2); +%! legend ([h1, h2], {"Blue", "Green"}, "location", "south"); + +%!demo +%! x = 0:10; +%! y1 = rand (size (x)); +%! y2 = rand (size (x)); +%! [ax, h1, h2] = plotyy (x, y1, x, y2); +%! legend ({"Blue", "Green"}, "location", "south"); + +%!demo +%! x = 0:10; +%! y1 = rand (size (x)); +%! y2 = rand (size (x)); +%! [ax, h1, h2] = plotyy (x, y1, x, y2); +%! legend ("Blue", "Green", "location", "south"); +