changeset 6166:17f25cd588b2

[project @ 2006-11-15 04:30:14 by jwe]
author jwe
date Wed, 15 Nov 2006 04:31:48 +0000
parents ea26b8fda4d7
children d9e9c436abb0
files scripts/ChangeLog scripts/plot/__do_legend__.m scripts/plot/__errplot__.m scripts/plot/__make_using_clause__.m scripts/plot/__plot_globals__.m scripts/plot/__plt3__.m scripts/plot/__plt__.m scripts/plot/bottom_title.m scripts/plot/top_title.m
diffstat 9 files changed, 55 insertions(+), 113 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,5 +1,10 @@
 2006-11-14  John W. Eaton  <jwe@octave.org>
 
+	* plot/bottom_title.m, plot/top_title.m: Delete.
+
+	* plot/__build_plot_command__.m: New function.
+	* plot/__plt__.m, plot/__plt3__.m, plot/__errplot__.m: Use it.
+
 	* image/image_viewer.m: Set default values here.
 	* image/image.m: Not here.
 
--- a/scripts/plot/__do_legend__.m
+++ b/scripts/plot/__do_legend__.m
@@ -1,3 +1,22 @@
+## Copyright (C) 2006 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2, or (at your option)
+## any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, write to the Free
+## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+## 02110-1301, USA.
+
 function __do_legend__ ()
 
   __plot_globals__;
--- a/scripts/plot/__errplot__.m
+++ b/scripts/plot/__errplot__.m
@@ -58,7 +58,7 @@
   nplots = size (a1, 2);
   len = size (a1, 1);
   for i = 1:nplots
-    ifmt = fmt{1+mod(i-1,numel(fmt))};
+    fmtstr = fmt{1+mod(i-1,numel(fmt))};
     if (i <= nkey)
       __plot_key_labels__{cf}{mxi,myi}{loff} = key{i};
     else
@@ -70,9 +70,9 @@
       case 3
 	tmp = [a1(:,i), a2(:,i), a3(:,i)];
       case 4
-	if (index (ifmt, "boxxy") || index (ifmt, "xyerr"))
+	if (index (fmtstr, "boxxy") || index (fmtstr, "xyerr"))
 	  tmp = [a1(:,i), a2(:,i), a3(:,i), a4(:,i)];
-	elseif (index (ifmt, "xerr"))
+	elseif (index (fmtstr, "xerr"))
 	  tmp = [a1(:,i), a2(:,i), a1(:,i)-a3(:,i), a1(:,i)+a4(:,i)];
 	else
 	  tmp = [a1(:,i), a2(:,i), a2(:,i)-a3(:,i), a2(:,i)+a4(:,i)];
@@ -88,11 +88,9 @@
 
     __plot_data__{cf}{mxi,myi}{j} = tmp;
 
-    __plot_command__{cf}{mxi,myi} \
-	= sprintf ("%s%s __plot_data__{__current_figure__}{__multiplot_xi__(__current_figure__),__multiplot_yi__(__current_figure__)}{%d} %s %s __plot_key_labels__{__current_figure__}{__multiplot_xi__(__current_figure__),__multiplot_yi__(__current_figure__)}{%d}",
-		   __plot_command__{cf}{mxi,myi},
-		   __plot_command_sep__, j, ifmt,
-		   gnuplot_command_title, loff);
+    __plot_command__{cf}{mxi,myi} ...
+	= __build_plot_command__ (j, "", fmtstr, loff, "");
+
     __plot_command_sep__ = ",\\\n";
 
     j++;
--- a/scripts/plot/__make_using_clause__.m
+++ b/scripts/plot/__make_using_clause__.m
@@ -1,3 +1,22 @@
+## Copyright (C) 2006 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2, or (at your option)
+## any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, write to the Free
+## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+## 02110-1301, USA.
+
 function usingstr = __make_using_clause__ (x)
   cols = columns (x);
   if (cols > 0)
--- a/scripts/plot/__plot_globals__.m
+++ b/scripts/plot/__plot_globals__.m
@@ -17,10 +17,6 @@
 ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 ## 02110-1301, USA.
 
-## This is a script file shared by __plt__ and __errplot__.
-
-## global variables to keep track of multiplot options
-
 global __current_figure__;
 global __plot_data_offset__;
 global __plot_line_offset__;
--- a/scripts/plot/__plt3__.m
+++ b/scripts/plot/__plt3__.m
@@ -71,14 +71,12 @@
   endif
 
   __plot_command__{cf}{mxi,myi} ...
-      = sprintf ("%s%s __plot_data__{__current_figure__}{__multiplot_xi__(__current_figure__),__multiplot_yi__(__current_figure__)}{%d} %s %s %s __plot_key_labels__{__current_figure__}{__multiplot_xi__(__current_figure__),__multiplot_yi__(__current_figure__)}{%d} %s",
-		 __plot_command__{cf}{mxi,myi},
-		 __plot_command_sep__, j++, usingstr, fmtstr,
-		 gnuplot_command_title, loff++, withstr);
+      = __build_plot_command__ (j, usingstr, fmtstr, loff, withstr);
+
   __plot_command_sep__ = ",\\\n";
 
-  __plot_data_offset__{cf}(mxi,myi) = j;
-  __plot_line_offset__{cf}(mxi,myi) = loff;
+  __plot_data_offset__{cf}(mxi,myi) = ++j;
+  __plot_line_offset__{cf}(mxi,myi) = ++loff;
 
   if (__multiplot_mode__(cf))
     __gnuplot_raw__ ("clear\n");
--- a/scripts/plot/__plt__.m
+++ b/scripts/plot/__plt__.m
@@ -106,11 +106,9 @@
 	for i = 1:length (__plot_data__{cf}{mxi,myi}{j})
 	  usingstr = __make_using_clause__ (__plot_data__{cf}{mxi,myi}{j}{i});
 	  __plot_command__{cf}{mxi,myi} ...
-	      = sprintf ("%s%s __plot_data__{__current_figure__}{__multiplot_xi__(__current_figure__),__multiplot_yi__(__current_figure__)}{%d}{%d} %s %s %s __plot_key_labels__{__current_figure__}{__multiplot_xi__(__current_figure__),__multiplot_yi__(__current_figure__)}{%d}",
-			 __plot_command__{cf}{mxi,myi},
-			 __plot_command_sep__, j, i, usingstr,
-			 fmtstr{i}, gnuplot_command_title, loff++);
+	      = __build_plot_command__ ([j, i], usingstr, fmtstr{i}, loff, "");
 	  __plot_command_sep__ = ",\\\n";
+	  loff++;
 	endfor
 	j++;
       endif
deleted file mode 100644
--- a/scripts/plot/bottom_title.m
+++ /dev/null
@@ -1,43 +0,0 @@
-## Copyright (C) 1996, 1997 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 2, or (at your option)
-## any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, write to the Free
-## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-## 02110-1301, USA.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} bottom_title (@var{string})
-## See top_title.
-## @end deftypefn
-
-## Author: Vinayak Dutt <Dutt.Vinayak@mayo.EDU>
-## Adapted-By: jwe
-
-function bottom_title (text)
-
-  if (nargin != 1)
-    print_usage ();
-  endif
-
-  if (ischar (text))
-    __gnuplot_raw__ ("set top_title;\n");
-    __gnuplot_raw__ ("set title;\n");
-    __gnuplot_raw__ (sprintf ("set bottom_title \"%s\";\n",
-			      undo_string_escapes (text)));
-  else
-    error ("bottom_title: text must be a string");
-  endif
-
-endfunction
deleted file mode 100644
--- a/scripts/plot/top_title.m
+++ /dev/null
@@ -1,48 +0,0 @@
-## Copyright (C) 1996, 1997 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 2, or (at your option)
-## any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, write to the Free
-## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-## 02110-1301, USA.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} top_title (@var{string})
-## @deftypefnx {Function File} {} bottom_title (@var{string})
-## Makes a title with text @var{string} at the top (bottom) of the plot.
-## @end deftypefn
-
-## Author: Vinayak Dutt <Dutt.Vinayak@mayo.EDU>
-## Created: 3 July 95
-## Adapted-By: jwe
-
-function top_title (text)
-
-  if (nargin != 1)
-    print_usage ();
-  endif
-
-  if (ischar (text))
-    __gnuplot_raw__ ("set bottom_title;\n")
-    __gnuplot_raw__ ("set title;\n")
-    __gnuplot_raw__ (sprintf ("set top_title \"%s\";\n",
-			      undo_string_escapes (text)));
-    if (automatic_replot)
-      replot ();
-    endif
-  else
-    error ("error: top_title: text must be a string");
-  endif
-
-endfunction