comparison scripts/plot/legend.m @ 17179:828e8852efa9

legend.m: Add %!demo block showing bug #39697. * scripts/plot/legend.m: Add %!demo block showing bug #39697.
author Rik <rik@octave.org>
date Sun, 04 Aug 2013 22:11:20 -0700
parents c3c1ebfaa7dc
children df4c4b7708a4
comparison
equal deleted inserted replaced
17178:f010db8b710c 17179:828e8852efa9
593 ypad = 2; 593 ypad = 2;
594 594
595 linelength = 15; 595 linelength = 15;
596 596
597 ## Create the axis first 597 ## Create the axis first
598 ## FIXME hlegend should inherit properties from "ca" 598 ## FIXME: hlegend should inherit properties from "ca"
599 curaxes = get (fig, "currentaxes"); 599 curaxes = get (fig, "currentaxes");
600 unwind_protect 600 unwind_protect
601 ud = ancestor (hplots, "axes"); 601 ud = ancestor (hplots, "axes");
602 if (!isscalar (ud)) 602 if (!isscalar (ud))
603 ud = unique ([ud{:}]); 603 ud = unique ([ud{:}]);
704 - unmodified_axes_position(3); 704 - unmodified_axes_position(3);
705 else 705 else
706 gnuplot_offset = unmodified_axes_position(1) ... 706 gnuplot_offset = unmodified_axes_position(1) ...
707 - unmodified_axes_outerposition(1); 707 - unmodified_axes_outerposition(1);
708 endif 708 endif
709 ## FIXME - the "fontsize" is added to match the behavior of OpenGL. 709 ## FIXME: The "fontsize" is added to match the behavior of OpenGL.
710 ## This implies that a change in fontsize should trigger a listener 710 ## This implies that a change in fontsize should trigger a listener
711 ## to update the legend. The "2" was determined using a long legend 711 ## to update the legend. The "2" was determined using a long legend
712 ## key in the absence of any subplots. 712 ## key in the absence of any subplots.
713 gnuplot_offset = gnuplot_offset - 2 * fontsize; 713 gnuplot_offset = gnuplot_offset - 2 * fontsize;
714 else 714 else
984 addlistener (hlegend, "interpreter", @updatelegendtext); 984 addlistener (hlegend, "interpreter", @updatelegendtext);
985 addlistener (hlegend, "location", @updatelegend); 985 addlistener (hlegend, "location", @updatelegend);
986 addlistener (hlegend, "orientation", @updatelegend); 986 addlistener (hlegend, "orientation", @updatelegend);
987 addlistener (hlegend, "string", @updatelegend); 987 addlistener (hlegend, "string", @updatelegend);
988 addlistener (hlegend, "textposition", @updatelegend); 988 addlistener (hlegend, "textposition", @updatelegend);
989 ## TODO - need to add listeners for tighinset and position 989 ## FIXME: need to add listeners for tighinset and position
990 ## addlistener (ca, "tightinset", @update????); 990 ## addlistener (ca, "tightinset", @update????);
991 ## addlistener (ca, "position", @update????); 991 ## addlistener (ca, "position", @update????);
992 endif 992 endif
993 unwind_protect_cleanup 993 unwind_protect_cleanup
994 set (fig, "currentaxes", curaxes); 994 set (fig, "currentaxes", curaxes);
1551 %! xlabel ('xlabel'); 1551 %! xlabel ('xlabel');
1552 %! ylabel ('ylabel'); 1552 %! ylabel ('ylabel');
1553 %! legend ({'12345678901234567890'}, 'location', 'southwestoutside'); 1553 %! legend ({'12345678901234567890'}, 'location', 'southwestoutside');
1554 %! legend (option); 1554 %! legend (option);
1555 1555
1556 %!demo % bug 39697
1557 %! plot (1:10);
1558 %! legend ("Legend Text");
1559 %! title ({"Multi-line", "titles", "are a", "problem"});
1560
1556 %!test 1561 %!test
1557 %! toolkit = graphics_toolkit ("gnuplot"); 1562 %! toolkit = graphics_toolkit ("gnuplot");
1558 %! h = figure ("visible", "off"); 1563 %! h = figure ("visible", "off");
1559 %! unwind_protect 1564 %! unwind_protect
1560 %! position = get (h, "position"); 1565 %! position = get (h, "position");