diff scripts/plot/__go_draw_axes__.m @ 6829:6c85f7d37e61

[project @ 2007-08-24 20:23:21 by dbateman]
author dbateman
date Fri, 24 Aug 2007 20:26:24 +0000
parents 5e61f0bc0c27
children 9adfed86501f
line wrap: on
line diff
--- a/scripts/plot/__go_draw_axes__.m	Fri Aug 24 16:59:48 2007 +0000
+++ b/scripts/plot/__go_draw_axes__.m	Fri Aug 24 20:26:24 2007 +0000
@@ -599,22 +599,51 @@
 	  halign = obj.horizontalalignment;
 	  angle = obj.rotation;
           units = obj.units;
+	  color = obj.color;
           if (strcmpi (units, "normalized"))
             units = "graph";
           else
             units = "";
           endif
 	  
+	  if (isnumeric (color))
+	    if (have_newer_gnuplot)
+	      colorspec = sprintf ("textcolor rgb \"#%02x%02x%02x\"",
+		       round (255*color));
+	    else
+	      if (isequal (color, [0,0,0]))
+		typ = -1;
+	      elseif (isequal (color, [1,0,0]))
+		typ = 1;
+	      elseif (isequal (color, [0,1,0]))
+		typ = 2;
+	      elseif (isequal (color, [0,0,1]))
+		typ = 3;
+	      elseif (isequal (color, [1,0,1]))
+		typ = 4;
+	      elseif (isequal (color, [0,1,1]))
+		typ = 5;
+	      elseif (isequal (color, [1,1,1]))
+		typ = -1;
+	      elseif (isequal (color, [1,1,0]))
+		typ = 7;
+	      else
+		typ = -1;
+	      endif
+	      colorspec = sprintf ("textcolor lt %d", typ);
+	    endif
+	  endif
+
 	  if (nd == 3)
 	    fprintf (plot_stream,
-		     "set label \"%s\" at %s %g,%g,%g %s rotate by %f;\n",
+		     "set label \"%s\" at %s %g,%g,%g %s rotate by %f %s;\n",
 		     undo_string_escapes (label), units,
-		     lpos(1), lpos(2), lpos(3), halign, angle);
+		     lpos(1), lpos(2), lpos(3), halign, angle, colorspec);
 	  else
 	    fprintf (plot_stream,
-		     "set label \"%s\" at %s %g,%g %s rotate by %f;\n",
+		     "set label \"%s\" at %s %g,%g %s rotate by %f %s;\n",
 		     undo_string_escapes (label), units,
-		     lpos(1), lpos(2), halign, angle);
+		     lpos(1), lpos(2), halign, angle, colorspec);
 	  endif
 
 	otherwise