# HG changeset patch # User jwe # Date 1163565108 0 # Node ID 17f25cd588b21b5f9aca6e8040a395f603a5d04d # Parent ea26b8fda4d71d7fa1282ce7928ae7d2e7f659a7 [project @ 2006-11-15 04:30:14 by jwe] diff -r ea26b8fda4d7 -r 17f25cd588b2 scripts/ChangeLog --- a/scripts/ChangeLog Tue Nov 14 23:32:28 2006 +0000 +++ b/scripts/ChangeLog Wed Nov 15 04:31:48 2006 +0000 @@ -1,5 +1,10 @@ 2006-11-14 John W. Eaton + * 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. diff -r ea26b8fda4d7 -r 17f25cd588b2 scripts/plot/__do_legend__.m --- a/scripts/plot/__do_legend__.m Tue Nov 14 23:32:28 2006 +0000 +++ b/scripts/plot/__do_legend__.m Wed Nov 15 04:31:48 2006 +0000 @@ -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__; diff -r ea26b8fda4d7 -r 17f25cd588b2 scripts/plot/__errplot__.m --- a/scripts/plot/__errplot__.m Tue Nov 14 23:32:28 2006 +0000 +++ b/scripts/plot/__errplot__.m Wed Nov 15 04:31:48 2006 +0000 @@ -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++; diff -r ea26b8fda4d7 -r 17f25cd588b2 scripts/plot/__make_using_clause__.m --- a/scripts/plot/__make_using_clause__.m Tue Nov 14 23:32:28 2006 +0000 +++ b/scripts/plot/__make_using_clause__.m Wed Nov 15 04:31:48 2006 +0000 @@ -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) diff -r ea26b8fda4d7 -r 17f25cd588b2 scripts/plot/__plot_globals__.m --- a/scripts/plot/__plot_globals__.m Tue Nov 14 23:32:28 2006 +0000 +++ b/scripts/plot/__plot_globals__.m Wed Nov 15 04:31:48 2006 +0000 @@ -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__; diff -r ea26b8fda4d7 -r 17f25cd588b2 scripts/plot/__plt3__.m --- a/scripts/plot/__plt3__.m Tue Nov 14 23:32:28 2006 +0000 +++ b/scripts/plot/__plt3__.m Wed Nov 15 04:31:48 2006 +0000 @@ -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"); diff -r ea26b8fda4d7 -r 17f25cd588b2 scripts/plot/__plt__.m --- a/scripts/plot/__plt__.m Tue Nov 14 23:32:28 2006 +0000 +++ b/scripts/plot/__plt__.m Wed Nov 15 04:31:48 2006 +0000 @@ -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 diff -r ea26b8fda4d7 -r 17f25cd588b2 scripts/plot/bottom_title.m --- a/scripts/plot/bottom_title.m Tue Nov 14 23:32:28 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -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 -## 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 diff -r ea26b8fda4d7 -r 17f25cd588b2 scripts/plot/top_title.m --- a/scripts/plot/top_title.m Tue Nov 14 23:32:28 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -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 -## 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