changeset 3062:7310b801f8c2

[project @ 1997-06-26 02:11:29 by jwe]
author jwe
date Thu, 26 Jun 1997 02:11:35 +0000
parents 1a5fe3010f09
children 4287b8c06fbf
files scripts/ChangeLog scripts/plot/__pltopt__.m
diffstat 2 files changed, 57 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Wed Jun 25 18:37:30 1997 +0000
+++ b/scripts/ChangeLog	Thu Jun 26 02:11:35 1997 +0000
@@ -1,3 +1,8 @@
+Wed Jun 25 21:06:10 1997  Rick Niles <niles@axp745.gsfc.nasa.gov>
+
+	* plot/__pltopt__.m: Handle key/legend names.
+	Correctly set colors, line styles, and point styles.
+
 Wed Jun 25 13:34:06 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* polynomial/polyfit.m: Return fit y values as second output.
--- a/scripts/plot/__pltopt__.m	Wed Jun 25 18:37:30 1997 +0000
+++ b/scripts/plot/__pltopt__.m	Thu Jun 26 02:11:35 1997 +0000
@@ -39,24 +39,27 @@
 ##   "n"   with n in 1-6 (wraps at 8), plot color
 ##   "nm"  with m in 1-6 (wraps at 6), point style (only valid for "@" or "-@")
 ##   "c"   where c is one of ["r", "g", "b", "m", "c", "w"] colors.
+##   ";title;" where "title" is the label for the key.
 ##
 ##   Special points formats:
 ##
-##      "+", "*", "o", "x" will display points in that style.
+##      "+", "*", "o", "x" will display points in that style for term x11.
 ##
 ##   The legend may be fixed to include the name of the variable
 ##   plotted in some future version of Octave.
 ##
-##   The color line styles have the following meanings on terminals
-##   that support color.
+##   The colors, line styles, and point styles have the following
+##   meanings for X11 and Postscript terminals under Gnuplot 3.6.
 ##
-##     Number  Gnuplot colors     (lines)points style
-##       1       red                 "*"
-##       2       green               "+"
-##       3       blue                "o"
-##       4       magenta             "x"
-##       5       cyan                house
-##       6       brown               there exists
+##   Number ------ Color -------  Line Style      ---- Points Style ----   
+##          x11       postscript  postscript      x11         postscript   
+##   =====================================================================
+##     1    red       green       solid           "o"         "+"         
+##     2    green     blue        long dash       "+"         "x"         
+##     3    blue      red         short dash     square       "*"         
+##     4    magenta   magenta     dotted          "x"        open square  
+##     5    cyan      cyan        dot long dash  triangle    filled square
+##     6    brown     yellow      dot short dash  "*"         "o"         
 
 ## Author: Rick Niles <niles@axp745.gsfc.nasa.gov>
 ## Adapted-By: jwe
@@ -73,6 +76,7 @@
   set_steps = 0;
   set_boxes = 0;
   set_errbars = 0;
+  set_key = 0;
   more_opts = 1;
 
   WITH = "w";
@@ -85,6 +89,7 @@
   IMPULSES = "i";
   STEPS = "s";
   ERRORBARS = "e";
+  TITLE = "title";
 
   if (nargin != 2)
     usage ("__pltopt__ (opt)");
@@ -99,7 +104,9 @@
     ## First get next char.
 
     if (max (size (opt)) > 1)
-      [char, opt] = sscanf (opt, "%c %s", "C");
+#      [char, opt] = sscanf (opt, "%c %s", "C");
+       char = opt(1);
+       opt = opt(2:length(opt));
     else
       char = opt;
       more_opts = 0;
@@ -155,7 +162,7 @@
     elseif (strcmp (char, "*"))
       set_points = 1;
       set_symbol = 1;
-      symbol = "1";
+      symbol = "6";
     elseif (strcmp (char, "+"))
       set_points = 1;
       set_symbol = 1;
@@ -163,13 +170,41 @@
     elseif (strcmp (char, "o"))
       set_points = 1;
       set_symbol = 1;
-      symbol = "3";
+      symbol = "1";
     elseif (strcmp (char, "x"))
       set_points = 1;
       set_symbol = 1;
       symbol = "4";
+    elseif (strcmp (char, ";"))  # title mode.
+      set_key = 1;
+      working = 1;
+      key_title = ""; 
+      while (working)
+        if (max (size (opt)) > 1)
+	  char = opt(1);
+	  opt = opt(2:length(opt))
+        else
+	  char = opt;
+	  if (! strcmp (char, ";"))
+            error ("%s: unfinished key label", caller);
+          end
+          more_opts = 0;
+          working = 0;
+        endif
+        if strcmp (char, ";")
+          working = 0;
+        else
+	  if (isempty (key_title))  # needs this to avoid empty matrix warning.
+            key_title = char;
+	  else
+            key_title = strcat (key_title, char);
+	  endif
+        endif
+      endwhile
+    elseif (strcmp (char, " ")) 
+      ## whitespace -- do nothing.
     else
-      error (sprintf ("%s: unrecognized format character %s", caller, char));
+      error ("%s: unrecognized format character: '%s'", caller, char);
     endif
   endwhile
 
@@ -214,4 +249,7 @@
     fmt = strcat (fmt, " 1 ", symbol);
   endif
 
+  if (set_key)
+    fmt = strcat (fmt, " ", TITLE, ' "', key_title, '" ');
+  endif
 endfunction