changeset 22629:4bd7bab38f39

Add stem example to the hggroup type of legend (bug #49341). * legend.m: For demo 17, use 2x1 subplots and add a stem example. Place both plot legends in the northwest corner.
author Daniel J Sebald <daniel.sebald@ieee.org>
date Sat, 15 Oct 2016 11:21:17 -0500
parents 76f1164d2135
children 5ab3c91fc4bb
files scripts/plot/appearance/legend.m
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/appearance/legend.m	Fri Oct 14 15:42:08 2016 -0700
+++ b/scripts/plot/appearance/legend.m	Sat Oct 15 11:21:17 2016 -0500
@@ -1364,11 +1364,17 @@
 
 %!demo
 %! clf;
+%! subplot (2,1,1);
 %! rand_2x3_data1 = [0.341447, 0.171220, 0.284370; 0.039773, 0.731725, 0.779382];
 %! bar (rand_2x3_data1);
 %! ylim ([0 1.0]);
 %! title ("legend() works for bar graphs (hggroups)");
-%! legend ({"1st Bar", "2nd Bar", "3rd Bar"});
+%! legend ({"1st Bar", "2nd Bar", "3rd Bar"}, "location", "northwest");
+%! subplot (2,1,2);
+%! x = linspace (0, 10);
+%! stem (0.5+x.*rand (size (x)) / max (x));
+%! title ("legend() works for stem plots (hggroups)");
+%! legend ("Stem Rand", "location", "northwest");
 
 %!demo
 %! clf;