changeset 8291:53f35799b235

Add support for left/right argument to the legend function
author David Bateman <dbateman@free.fr>
date Thu, 30 Oct 2008 14:15:12 +0100
parents 7cbe01c21986
children 242756f065f0
files scripts/ChangeLog scripts/plot/__go_draw_axes__.m scripts/plot/legend.m src/ChangeLog src/graphics.cc src/graphics.h.in
diffstat 6 files changed, 22 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Mon Oct 20 16:54:28 2008 +0200
+++ b/scripts/ChangeLog	Thu Oct 30 14:15:12 2008 +0100
@@ -1,5 +1,9 @@
 2008-10-30  David Bateman  <dbateman@free.fr>
 
+	* plot/legend.m: Add support for the "left" and "right" options.
+	* plot/__go_draw_axes__.m: If the axes property keyreverse is set,
+	reverse the key and labelling text.
+	
 	* plot/__clabel__.m, plot/clabel.m: New functions.
 	* plot/Makefile.in (SOURCES): Add them here.
 	* plot/__contour__.m: Rewrite to use contour groups.
--- a/scripts/plot/__go_draw_axes__.m	Mon Oct 20 16:54:28 2008 +0200
+++ b/scripts/plot/__go_draw_axes__.m	Thu Oct 30 14:15:12 2008 +0100
@@ -1053,6 +1053,11 @@
       else
 	box = "nobox";
       endif
+      if (strcmpi (axis_obj.keyreverse, "on"))
+	reverse = "reverse";
+      else
+	reverse = "noreverse";
+      endif
       inout = "inside";
       keypos = axis_obj.keypos;
       if (ischar (keypos))
@@ -1099,7 +1104,7 @@
 	otherwise
 	  pos = "";
       endswitch
-      fprintf (plot_stream, "set key %s %s %s;\n", inout, pos, box);
+      fprintf (plot_stream, "set key %s %s %s %s;\n", inout, pos, box, reverse);
     else
       fputs (plot_stream, "unset key;\n");
     endif
--- a/scripts/plot/legend.m	Mon Oct 20 16:54:28 2008 +0200
+++ b/scripts/plot/legend.m	Thu Oct 30 14:15:12 2008 +0100
@@ -130,6 +130,10 @@
 	    set (ca, "key", "on", "keybox", "on");
 	  case "boxoff"
 	    set (ca, "keybox", "off");
+	  case "left"
+	    set (ca, "keyreverse", "off")
+	  case "right"
+	    set (ca, "keyreverse", "on")
 	  otherwise
 	    typ = get (kids (k), "type");
 	    while (k <= nkids && ! strcmp (typ, "line") &&
--- a/src/ChangeLog	Mon Oct 20 16:54:28 2008 +0200
+++ b/src/ChangeLog	Thu Oct 30 14:15:12 2008 +0100
@@ -1,3 +1,9 @@
+2008-10-30  David Bateman  <dbateman@free.fr>
+
+	* graphic.h.in (axes::properties): Add keyreverse property.
+	* graphic.cc (axes::properties::set_defaults): Initialize
+	keyreverse property.
+
 2008-10-28  Jaroslav Hajek <highegg@gmail.com>
 
 	* Cell.h (Cell::assign (const Array<idx_vector>&, ...),
--- a/src/graphics.cc	Mon Oct 20 16:54:28 2008 +0200
+++ b/src/graphics.cc	Thu Oct 30 14:15:12 2008 +0100
@@ -2293,6 +2293,7 @@
   box = "on";
   key = "off";
   keybox = "off";
+  keyreverse = "off";
   keypos = 1.0;
   colororder = default_colororder ();
   dataaspectratio = Matrix (1, 3, 1.0);
--- a/src/graphics.h.in	Mon Oct 20 16:54:28 2008 +0200
+++ b/src/graphics.h.in	Thu Oct 30 14:15:12 2008 +0100
@@ -2559,6 +2559,7 @@
       bool_property box , "on"
       bool_property key , "off"
       bool_property keybox , "off"
+      bool_property keyreverse , "off"
       any_property keypos , 1
       array_property colororder , default_colororder ()
       array_property dataaspectratio m , Matrix (1, 3, 1.0)