changeset 17532:492d609d2d75

legend.m: Default text labels to "right" alignment for Matlab compatibility. * scripts/plot/legend.m: Default text labels to "right" alignment for Matlab compatibility. Modify documentation and %!demos to match new behavior.
author Rik <rik@octave.org>
date Tue, 01 Oct 2013 16:03:02 -0700
parents bed7ec6f9855
children bb7756dff055
files scripts/plot/legend.m
diffstat 1 files changed, 12 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/legend.m	Tue Oct 01 15:51:28 2013 -0700
+++ b/scripts/plot/legend.m	Tue Oct 01 16:03:02 2013 -0700
@@ -73,17 +73,17 @@
 ##   Toggles between @qcode{"hide"} and @qcode{"show"}
 ##
 ## @item @qcode{"boxon"}
-##   Show a box around legend
+##   Show a box around legend (default)
 ##
 ## @item @qcode{"boxoff"}
 ##   Hide the box around legend
 ##
+## @item @qcode{"right"}
+##   Place label text to the right of the keys (default)
+##
 ## @item @qcode{"left"}
 ##   Place label text to the left of the keys
 ##
-## @item @qcode{"right"}
-##   Place label text to the right of the keys
-##
 ## @item @qcode{"off"}
 ##   Delete the legend object
 ## @end table
@@ -260,13 +260,13 @@
               show = "on";
             else
               show = "create";
-              textpos = "left";
+              textpos = "right";
             endif
             nargs--;
           case "toggle"
             if (isempty (hlegend))
               show = "create";
-              textpos = "left";
+              textpos = "right";
             elseif (strcmp (get (hlegend, "visible"), "off"))
               show = "on";
             else
@@ -530,7 +530,7 @@
         box = get (hlegend, "box");
       else
         if (strcmp (textpos, "default"))
-          textpos = "left";
+          textpos = "right";
         endif
         if (strcmp (location, "default"))
           location = "northeast";
@@ -1220,18 +1220,18 @@
 %!demo
 %! clf;
 %! plot (1:10, 1:10, 1:10, fliplr (1:10));
-%! title ('Legend with text to the right of key');
+%! title ('Legend with text to the left of key');
 %! legend ({'I am blue', 'I am green'}, 'location', 'east');
-%! legend right
+%! legend left
 
 %!demo
 %! clf;
 %! plot (1:10, 1:10, 1:10, fliplr (1:10));
-%! title ({'Use properties to place legend text to the right of key', ...
+%! title ({'Use properties to place legend text to the left of key', ...
 %!         'Legend text color is magenta'});
 %! h = legend ({'I am blue', 'I am green'}, 'location', 'east');
-%! legend ('left');
-%! set (h, 'textposition', 'right');
+%! legend ('right');
+%! set (h, 'textposition', 'left');
 %! set (h, 'textcolor', [1 0 1]);
 
 %!demo