diff scripts/plot/draw/stem.m @ 18463:2d0afa04d103

Make stemseries share the same baseline (bug #41593). * __stem__.m: Create only one baseline line object. Move baseline addlistener after the main loop. Move setting prop/val after the main loop. Add an argument to show_baseline in order to manage "visibility" hg property. * __stem__.m (move_baseline): update the line "basevalue" property. * stem.m: Add %!test for new behavior.
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Sat, 15 Feb 2014 14:14:10 +0100
parents d63878346099
children 0e1f5a750d00
line wrap: on
line diff
--- a/scripts/plot/draw/stem.m	Thu Feb 13 22:29:44 2014 -0500
+++ b/scripts/plot/draw/stem.m	Sat Feb 15 14:14:10 2014 +0100
@@ -187,7 +187,7 @@
 %! y = [sin(x), cos(x)];
 %! h = stem (x, y);
 %! set (h(2), 'color', 'g');
-%! set (h(1), 'basevalue', -1);
+%! set (h(1), 'basevalue', -0.75);
 %! title ('stem plots modified through hggroup handle');
 
 %!demo
@@ -213,3 +213,18 @@
 %!error <inconsistent sizes for X and Y> stem (ones (2,2), ones (3,3))
 %!error <No value specified for property "FOO"> stem (1, "FOO")
 
+%!test
+%! ## stemseries share the same baseline and basevalue
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   h = stem ([1 2; 1.5 2.5], [1 1;2 2]);
+%!   assert (get (h(1), "baseline"), get (h(2), "baseline"))
+%!   bv = 0.3;
+%!   set (h(1), "basevalue", bv)
+%!   assert (get (get (h(1), "baseline"), "basevalue"), bv)
+%!   assert (get (h(1), "basevalue"), bv)
+%!   assert (get (h(2), "basevalue"), bv)
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+