octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Add position options for legend?


From: Peter Gustafson
Subject: Add position options for legend?
Date: Thu, 09 Aug 2007 11:58:53 -0400
User-agent: Thunderbird 2.0.0.6 (X11/20070806)

Hi,

legend no longer has as many options as the octave-forge version did. 
I'm not sure if that was on purpose or not, but I often use the below
option.  This patch restores the prior function if there is interest. 
At some point we might want to make it more matlab compatible but that
would be a low priority for me.

Pete

2007-07-26  Peter Gustafson  <address@hidden>

        * scripts/plot/__go_draw_axes__.m: Add position options for
legend. Note -1 is conforms to older octave-forge version.
        * scripts/plot/legend.m: Change info to reflect additional
positions.


Index: scripts/plot/__go_draw_axes__.m
===================================================================
RCS file: /cvs/octave/scripts/plot/__go_draw_axes__.m,v
retrieving revision 1.32
diff -u -r1.32 __go_draw_axes__.m
--- scripts/plot/__go_draw_axes__.m     24 Jul 2007 19:02:27 -0000      1.32
+++ scripts/plot/__go_draw_axes__.m     9 Aug 2007 15:19:04 -0000
@@ -673,9 +673,14 @@
       endif
       inout = "inside";
       switch (axis_obj.keypos)
-       case -1
+       case -3
+         pos = "below";
+       case -2
          pos = "right bottom";
          inout = "outside";
+       case -1
+         pos = "right top";
+         inout = "outside";
        case 1
          pos = "right top";
        case 2
Index: scripts/plot/legend.m
===================================================================
RCS file: /cvs/octave/scripts/plot/legend.m,v
retrieving revision 1.10
diff -u -r1.10 legend.m
--- scripts/plot/legend.m       16 Jun 2007 15:51:49 -0000      1.10
+++ scripts/plot/legend.m       9 Aug 2007 15:19:04 -0000
@@ -36,8 +36,12 @@
 ## @var{pos} optionally  places the legend in the specified location:
 ##
 ## @multitable @columnfractions 0.1 0.1 0.8
-## @item @tab -1 @tab
+## @item @tab -3 @tab
+##   Below the plot
+## @item @tab -2 @tab
 ##   To the top right of the plot
+## @item @tab -1 @tab
+##   To the bottom right of the plot
 ## @item @tab 0 @tab
 ##   Don't move the legend box (default)
 ## @item @tab 1 @tab
@@ -80,7 +84,7 @@
   if (nargs > 0)
     pos = varargin{nargs};
     if (isnumeric (pos) && isscalar (pos) && round (pos) == pos)
-      if (pos >= -1 && pos <= 4)
+      if (pos >= -3 && pos <= 4)
        set (ca, "keypos", pos);
        nargs--;
       else

reply via email to

[Prev in Thread] Current Thread [Next in Thread]