changeset 10121:b5cc666da6ca

Support the '@' marker that was present in Octave 2.1.x
author David Bateman <dbateman@free.fr>
date Sat, 16 Jan 2010 07:59:52 +0100
parents 0c4445ef91a9
children 9d1a14e12431
files scripts/ChangeLog scripts/plot/__go_draw_axes__.m scripts/plot/plot.m scripts/plot/private/__pltopt__.m src/ChangeLog src/graphics.h.in
diffstat 6 files changed, 85 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Fri Jan 15 23:19:26 2010 +0100
+++ b/scripts/ChangeLog	Sat Jan 16 07:59:52 2010 +0100
@@ -1,6 +1,12 @@
+2010-01-16  David Bateman  <dbateman@free.fr>
+
+	* plot/__go_draw_axes__.m (next_marker):  New function to find a
+	new marker. Use it to support the "@" marker.
+	* plot/private/__pltopt__.m: Don't convert "@" marker ro "+";
+
 2010-01-15  David Bateman  <dbateman@free.fr>
 
-	plot/__go_draw_figure__.m: Respect the figure and axes color 
+	plot/__go_draw_figure__.m: Respect the figure and axes color
 	properties.
 
 2010-01-14  David Bateman  <dbateman@free.fr>
@@ -29,7 +35,7 @@
 
 2010-01-12  David Bateman  <dbateman@free.fr>
 
-	* plot/__go_draw_axes_.m:  Allow patch markerfacecolor and 
+	* plot/__go_draw_axes_.m:  Allow patch markerfacecolor and
 	markeredgecolor properties to be used and set the marker colors
 	appropriately.
 
--- a/scripts/plot/__go_draw_axes__.m	Fri Jan 15 23:19:26 2010 +0100
+++ b/scripts/plot/__go_draw_axes__.m	Sat Jan 16 07:59:52 2010 +0100
@@ -90,6 +90,10 @@
     fputs (plot_stream, "unset x2tics;\n");
     fputs (plot_stream, "unset x2tics;\n");
 
+    # Reset next marker calculation
+    markerorder = axis_obj.markerorder;
+    next_marker (0);
+
     if (! isempty (axis_obj.title))
       t = get (axis_obj.title);
       if (isempty (t.string))
@@ -523,7 +527,7 @@
 	  endif
 
 	  style = do_linestyle_command (obj, obj.color, data_idx, mono, 
-					plot_stream, errbars);
+					plot_stream, markerorder, errbars);
 
           withclause{data_idx} = sprintf ("with %s linestyle %d",
 					  style{1}, data_idx);
@@ -794,6 +798,8 @@
 	     if (isfield (obj, "marker"))
 	       if (isfield (obj, "marker"))
 		 switch (obj.marker)
+                   case "@"
+                     [pt, pt2] = next_marker (markerorder);
 		   case "+"
 		     pt = pt2 = "pt 1";
 		   case "o"
@@ -1025,7 +1031,7 @@
 	    have_3d_patch(data_idx) = false;
 	    style = do_linestyle_command (obj, obj.edgecolor,
 					  data_idx, mono, 
-					  plot_stream);
+					  plot_stream, markerorder);
 	    if (isempty (obj.keylabel))
 	      titlespec{data_idx} = "title \"\"";
 	    else
@@ -1567,7 +1573,7 @@
 endfunction
 
 function style = do_linestyle_command (obj, linecolor, idx, mono,
-				       plot_stream, errbars = "")
+				       plot_stream, markerorder, errbars = "")
   style = {};
 
   fprintf (plot_stream, "set style line %d default;\n", idx);
@@ -1627,6 +1633,8 @@
 
   if (isfield (obj, "marker"))
     switch (obj.marker)
+      case "@"
+        [pt, pt2] = next_marker (markerorder);
       case "+"
 	pt = pt2 = "1";
       case "o"
@@ -1784,6 +1792,57 @@
 
 endfunction
 
+function [pt, pt2] = next_marker (__set__)
+  persistent __next_marker__ = 0;
+
+  if (isnumeric (__set__))
+    __next_marker__ = __set__;
+  else
+
+    __marker__ = __set__ (rem (__next_marker__ ++, length (__set__)) + 1);
+    switch (__marker__)
+      case "+"
+	pt = pt2 = "1";
+      case "o"
+	pt = "6";
+	pt2 = "7";
+      case "*"
+	pt = pt2 = "3";
+      case "."
+	pt = pt2 = "0";
+      case "x"
+	pt = pt2 = "2";
+      case "s"
+	pt = "4";
+	pt2 = "5";
+      case "d"
+	pt = "13";
+	pt2 = "14";
+      case "^"
+	pt = "8";
+	pt2 = "9";
+      case "v"
+	pt = "10";
+	pt2 = "11";
+      case ">"
+	## FIXME missing point type 
+	pt = "8";
+	pt2 = "9";
+      case "<"
+	## FIXME missing point type 
+	pt = "10";
+	pt2 = "11";
+      case "p"
+	## FIXME missing point type 
+	pt = pt2 = "3";
+      case "h"
+	pt = pt2 = "3";
+      otherwise
+	pt = pt2 = "";
+    endswitch
+  endif
+endfunction
+
 function nd = __calc_dimensions__ (obj)
   kids = obj.children;
   nd = 2;
--- a/scripts/plot/plot.m	Fri Jan 15 23:19:26 2010 +0100
+++ b/scripts/plot/plot.m	Sat Jan 16 07:59:52 2010 +0100
@@ -130,6 +130,9 @@
 ## @itemx ^
 ## Used in combination with the points or linespoints styles, set the point
 ## style.
+##
+## @item @@
+## Select the next unused point style.
 ## @end table
 ##
 ## The @var{fmt} argument may also be used to assign key titles.
--- a/scripts/plot/private/__pltopt__.m	Fri Jan 15 23:19:26 2010 +0100
+++ b/scripts/plot/private/__pltopt__.m	Sat Jan 16 07:59:52 2010 +0100
@@ -177,10 +177,6 @@
 	      || topt == ">" || topt == "<" || topt == "p"
 	      || topt == "h" || topt == "@")
 	have_marker = true;
-	## Backward compatibility.  Leave undocumented.
-	if (topt == "@")
-	  topt = "+";
-	endif
 	options.marker = topt;
 ### Numeric color specs for backward compatibility.  Leave undocumented.
       elseif (topt == "k" || topt == "0")
--- a/src/ChangeLog	Fri Jan 15 23:19:26 2010 +0100
+++ b/src/ChangeLog	Sat Jan 16 07:59:52 2010 +0100
@@ -1,3 +1,10 @@
+2010-01-16  David Bateman  <dbateman@free.fr>
+
+	* graphics.h.in (line::properties, surface::properties,
+	patch::properties): Allow the use of a "@" marker.
+	(axes::properties): Add markerorder properties to set the
+	order of the marker styles for the "@" marker.
+
 2010-01-15  Jaroslav Hajek  <highegg@gmail.com>
 
 	* pt-mat.cc (SINGLE_TYPE_CONCAT, DO_SINGLE_TYPE_CONCAT,
--- a/src/graphics.h.in	Fri Jan 15 23:19:26 2010 +0100
+++ b/src/graphics.h.in	Sat Jan 16 07:59:52 2010 +0100
@@ -2764,6 +2764,8 @@
       // FIXME -- should be kind of string array.
       string_property linestyleorder , "-"
       double_property linewidth , 0.5
+      // FIXME -- should be kind of string array.
+      string_property markerorder , "+o*xsd^vh."
       radio_property minorgridlinestyle , "-|--|{:}|-.|none"
       array_property plotboxaspectratio m , Matrix (1, 3, 1.0)
       radio_property plotboxaspectratiomode , "{auto}|manual"
@@ -3002,7 +3004,7 @@
       color_property color , color_values (0, 0, 0)
       radio_property linestyle , "{-}|--|:|-.|none"
       double_property linewidth , 0.5
-      radio_property marker , "{none}|s|o|x|+|.|*|<|>|v|^|d|p|h"
+      radio_property marker , "{none}|s|o|x|+|.|*|<|>|v|^|d|p|h|@"
       color_property markeredgecolor , "{auto}|none"
       color_property markerfacecolor , "auto|{none}"
       double_property markersize , 6
@@ -3298,7 +3300,7 @@
       radio_property erasemode , "{normal}|background|xor|none"
       radio_property linestyle , "{-}|--|:|-.|none"
       double_property linewidth , 0.5
-      radio_property marker , "{none}|s|o|x|+|.|*|<|>|v|^|d|p|h"
+      radio_property marker , "{none}|s|o|x|+|.|*|<|>|v|^|d|p|h|@"
       color_property markeredgecolor , "{auto}|none|flat"
       color_property markerfacecolor , "auto|{none}|flat"
       double_property markersize , 6
@@ -3404,7 +3406,7 @@
       color_property edgecolor , color_property (color_values (0, 0, 0), radio_values ("flat|none|interp"))
       radio_property linestyle , "{-}|--|:|-.|none"
       double_property linewidth , 0.5
-      radio_property marker , "{none}|s|o|x|+|.|*|<|>|v|^|d|p|h"
+      radio_property marker , "{none}|s|o|x|+|.|*|<|>|v|^|d|p|h|@"
       color_property markeredgecolor , "{auto}|none"
       color_property markerfacecolor , "auto|{none}"
       double_property markersize , 6