changeset 6962:9ac23c7f1c37

[project @ 2007-10-05 20:52:19 by jwe]
author jwe
date Fri, 05 Oct 2007 20:52:19 +0000
parents b559b4bcf51f
children 642f481d2d50
files scripts/ChangeLog scripts/plot/__next_line_color__.m src/ChangeLog src/graphics.cc src/graphics.h.in
diffstat 5 files changed, 55 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Fri Oct 05 19:35:22 2007 +0000
+++ b/scripts/ChangeLog	Fri Oct 05 20:52:19 2007 +0000
@@ -1,3 +1,8 @@
+2007-10-05  John W. Eaton  <jwe@octave.org>
+
+	* plot/__next_line_color__.m: Get color_rotation from axes
+	colororder property.
+
 2007-10-03  John W. Eaton  <jwe@octave.org>
 
 	* miscellaneous/dir.m: Handle symbolic links in compatible way.
--- a/scripts/plot/__next_line_color__.m	Fri Oct 05 19:35:22 2007 +0000
+++ b/scripts/plot/__next_line_color__.m	Fri Oct 05 20:52:19 2007 +0000
@@ -25,25 +25,22 @@
 
 function rgb = __next_line_color__ (reset)
 
-  persistent color_rotation = [ 0,    0,    1;
-				0,    0.5,  0;
-				1,    0,    0;
-				0,    0.75, 0.75;
-				0.75, 0,    0.75;
-				0.75, 0.75, 0;
-				0.25, 0.25, 0.25];
-
-  persistent num_colors = rows (color_rotation);
-  persistent color_index = 1;
+  persistent color_rotation;
+  persistent num_colors;
+  persistent color_index;
 
   if (nargin < 2)
     if (nargin == 1 && reset)
+      color_rotation = get (gca (), "colororder");
+      num_colors = rows (color_rotation);
       color_index = 1;
-    else
+    elseif (! isempty (color_rotation))
       rgb = color_rotation(color_index,:);
       if (++color_index > num_colors)
 	color_index = 1;
       endif
+    else
+      error ("__next_line_color__: color_rotation not initialized");
     endif
   else
     print_usage ();
--- a/src/ChangeLog	Fri Oct 05 19:35:22 2007 +0000
+++ b/src/ChangeLog	Fri Oct 05 20:52:19 2007 +0000
@@ -1,5 +1,11 @@
 2007-10-05  John W. Eaton  <jwe@octave.org>
 
+	* graphics.h.in (axes::properties): New property, colororder.
+	* graphics.cc (default_colororder): New function.
+	(axes::properties::properties, axes::properties::get,
+	axes::properties::set_defaults,
+	axes::properties::factory_defaults, ): Handle colororder.
+
 	* mappers.cc (xzlgamma): New static function.
 	(install_mapper_functions): Pass xzlgamma for c_c_map for lgamma
 	mapper.  Pass 1 for can_ret_cmplx_for_real and set hi to
--- a/src/graphics.cc	Fri Oct 05 19:35:22 2007 +0000
+++ b/src/graphics.cc	Fri Oct 05 20:52:19 2007 +0000
@@ -1001,6 +1001,33 @@
 
 // ---------------------------------------------------------------------
 
+static Matrix
+default_colororder (void)
+{
+  Matrix retval (7, 3, 0.0);
+
+  retval(0,2) = 1.0;
+
+  retval(1,1) = 0.5;
+
+  retval(2,0) = 1.0;
+
+  retval(3,1) = 0.75;
+  retval(3,2) = 0.75;
+
+  retval(4,0) = 0.75;
+  retval(4,2) = 0.75;
+
+  retval(5,0) = 0.75;
+  retval(5,1) = 0.75;
+
+  retval(6,0) = 0.25;
+  retval(6,1) = 0.25;
+  retval(6,2) = 0.25;
+
+  return retval;
+}
+
 axes::properties::properties (const graphics_handle& mh,
 					const graphics_handle& p)
   : base_properties (go_name, mh, p),
@@ -1010,6 +1037,7 @@
     key ("off"),
     keybox ("off"),
     keypos (1),
+    colororder (default_colororder ()),
     dataaspectratio (Matrix (1, 3, 1.0)),
     dataaspectratiomode ("auto"),
     xlim (),
@@ -1163,6 +1191,8 @@
     set_keybox (val);
   else if (name.compare ("keypos"))
     set_keypos (val);
+  else if (name.compare ("colororder"))
+    set_colororder (val);
   else if (name.compare ("dataaspectratio"))
     set_dataaspectratio (val);
   else if (name.compare ("dataaspectratiomode"))
@@ -1269,6 +1299,7 @@
   key = "off";
   keybox = "off";
   keypos = 1;
+  colororder = default_colororder ();
   dataaspectratio = Matrix (1, 3, 1.0);
   dataaspectratiomode = "auto";
 
@@ -1392,6 +1423,7 @@
   m.assign ("key", key);
   m.assign ("keybox", keybox);
   m.assign ("keypos", keypos);
+  m.assign ("colororder", colororder);
   m.assign ("dataaspectratio", dataaspectratio);
   m.assign ("dataaspectratiomode", dataaspectratiomode);
   m.assign ("xlim", xlim);
@@ -1464,6 +1496,8 @@
     retval = keybox;
   else if (name.compare ("keypos"))
     retval = keypos;
+  else if (name.compare ("colororder"))
+    retval = colororder;
   else if (name.compare ("dataaspectratio"))
     retval = dataaspectratio;
   else if (name.compare ("dataaspectratiomode"))
@@ -1593,6 +1627,7 @@
   m["key"] = "off";
   m["keybox"] = "off";
   m["keypos"] = 1;
+  m["colororder"] = default_colororder ();
   m["dataaspectratio"] = Matrix (1, 3, 1.0);
   m["dataaspectratiomode"] = "auto";
 
--- a/src/graphics.h.in	Fri Oct 05 19:35:22 2007 +0000
+++ b/src/graphics.h.in	Fri Oct 05 20:52:19 2007 +0000
@@ -1136,6 +1136,7 @@
       octave_value key
       octave_value keybox
       octave_value keypos
+      octave_value colororder
       octave_value dataaspectratio m
       octave_value dataaspectratiomode
       octave_value xlim m