Mercurial > octave-nkf
changeset 4006:efac4b97bb09
[project @ 2002-07-26 01:20:46 by jwe]
author | jwe |
---|---|
date | Fri, 26 Jul 2002 01:20:46 +0000 |
parents | fc000ebb19df |
children | 31448e09d38e |
files | scripts/ChangeLog scripts/plot/__errplot__.m scripts/plot/__pltopt1__.m scripts/plot/__pltopt__.m scripts/plot/errorbar.m scripts/plot/plot.m |
diffstat | 6 files changed, 49 insertions(+), 116 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog Thu Jul 25 21:01:16 2002 +0000 +++ b/scripts/ChangeLog Fri Jul 26 01:20:46 2002 +0000 @@ -1,3 +1,15 @@ +2002-07-25 Teemu Ikonen <tpikonen@pcu.helsinki.fi> + + * plot/__errcomm__.m: New file. Common functionality for error plots. + * plot/loglogerr.m: New file. Double logarithm plots with errorbars. + * plot/semilogxerr.m: New file. Semilogarithm plots with errorbars. + * plot/semilogyerr.m: New file. Semilogarithm plots with errorbars + + * plot/errorbar.m: Use __errcomm__.m. + * plot/__errplot__.m: Minor cleanups. + * plot/__pltopt__.m: Handle boxxyerrorbars plot style. + * plot/__pltopt1__.m: Likewise. + 2002-07-10 John W. Eaton <jwe@bevo.che.wisc.edu> * general/rem.m: Delete redundant call to usage.
--- a/scripts/plot/__errplot__.m Thu Jul 25 21:01:16 2002 +0000 +++ b/scripts/plot/__errplot__.m Fri Jul 26 01:20:46 2002 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2000, Teemu Ikonen +## Copyright (C) 2000-2002 Teemu Ikonen ## ## This file is part of Octave. ## @@ -20,7 +20,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} __errplot__ (@var{args}) ## Really plot errorbar plots. User interface in function errorbar. -## +## ## @example ## __errplot__ (@var{arg1}, @var{arg2}, ..., @var{fmt}) ## @end example @@ -52,23 +52,23 @@ fstr = a; endif endwhile - + fmt = __pltopt__ ("__errplot__", fstr); - + nplots = size (arg1, 2); len = size (arg1, 1); - + if (ndata == 2) for i = 1:nplots, tmp = [(1:len)', arg1(:,i), arg2(:,i)]; cmd = sprintf ("gplot tmp %s", fmt(min(i, rows(fmt)), :) ); eval (cmd); - end + endfor elseif (ndata == 3) for i = 1:nplots, tstr = "tmp =[arg1(:,i)"; for j = 2:ndata, - tstr = [tstr, sprintf(", arg%d(:,i)", j)]; + tstr = [tstr, sprintf(", arg%d(:,i)", j)]; endfor tstr = [tstr, "];"]; eval (tstr); @@ -78,11 +78,11 @@ elseif (ndata == 4) for i = 1:nplots, # this is getting ugly if (index (fmt, "boxxy") || index (fmt, "xyerr")) - tstr = "tmp = [arg1(:,i), arg2(:,i), arg3(:,i), arg4(:,i)];"; + tstr = "tmp = [arg1(:,i), arg2(:,i), arg3(:,i), arg4(:,i)];"; elseif (index (fmt, "xerr")) - tstr = "tmp = [arg1(:,i), arg2(:,i), arg1(:,i)-arg3(:,i), arg1(:,i)+arg4(:,i)];"; + tstr = "tmp = [arg1(:,i), arg2(:,i), arg1(:,i)-arg3(:,i), arg1(:,i)+arg4(:,i)];"; else - tstr = "tmp = [arg1(:,i), arg2(:,i), arg2(:,i)-arg3(:,i), arg2(:,i)+arg4(:,i)];"; + tstr = "tmp = [arg1(:,i), arg2(:,i), arg2(:,i)-arg3(:,i), arg2(:,i)+arg4(:,i)];"; endif eval (tstr); cmd = sprintf ("gplot tmp %s", fmt(min(i, rows(fmt)), :) ); @@ -94,12 +94,12 @@ eval (tstr); cmd = sprintf ("gplot tmp %s", fmt(min(i, rows(fmt)), :) ); eval (cmd); - endfor - else + endfor + else for i = 1:nplots, tstr = "tmp = [arg1(:,i)"; for j = 2:ndata, - tstr = [tstr, sprintf(", arg%d(:,i)", j)]; + tstr = [tstr, sprintf(", arg%d(:,i)", j)]; endfor tstr = [tstr, "];"]; eval (tstr); @@ -107,24 +107,9 @@ eval (cmd); endfor endif + +endfunction + - ## if (ndata == 2) - ## for i = 1:nplots, - ## tmp = [(1:len)', arg1(:,i), arg2(:,i)]; - ## cmd = sprintf ("gplot tmp %s", fmt(min(i, rows(fmt)), :) ); - ## eval (cmd); - ## endfor - ## else - ## for i = 1:nplots, - ## tstr = "tmp =[arg1(:,i)"; - ## for j = 2:ndata, - ## tstr = [tstr, sprintf(", arg%d(:,i)", j)]; - ## endif - ## tstr = [tstr, "];"]; - ## eval (tstr); - ## cmd = sprintf ("gplot tmp %s", fmt(min(i, rows(fmt)), :) ); - ## eval (cmd); - ## endfor - ## endif -endfunction +
--- a/scripts/plot/__pltopt1__.m Thu Jul 25 21:01:16 2002 +0000 +++ b/scripts/plot/__pltopt1__.m Fri Jul 26 01:20:46 2002 +0000 @@ -49,6 +49,7 @@ LINESPOINTS = "linesp"; BOXERRORBARS = "boxer"; BOXES = "boxes"; + BOXXY = "boxxy"; POINTS = "p"; DOTS = "d"; IMPULSES = "i"; @@ -167,7 +168,7 @@ char = opt; if (! strcmp (char, ";")) error ("%s: unfinished key label", caller); - end + endif more_opts = 0; working = 0; endif @@ -182,6 +183,7 @@ endif endwhile elseif (strcmp (char, " ")) + elseif (isempty(char)) ## whitespace -- do nothing. else error ("%s: unrecognized format character: '%s'", caller, char); @@ -199,7 +201,9 @@ fmt = strcat (fmt, " ", LINES); endif elseif (set_boxes) - if (set_yerrbars) + if (set_yerrbars && set_xerrbars) + fmt = strcat (fmt, " ", BOXXY); + elseif (set_yerrbars ) fmt = strcat (fmt, " ", BOXERRORBARS); else fmt = strcat (fmt, " ", BOXES); @@ -223,7 +227,11 @@ endif if (strcmp (fmt, WITH)) - fmt = strcat (fmt, " ", LINES); + if(strcmp (caller, "__errplot")) + fmt = strcat (fmt, " ", YERRORBARS); + else + fmt = strcat (fmt, " ", LINES); + endif endif if (set_color)
--- a/scripts/plot/__pltopt__.m Thu Jul 25 21:01:16 2002 +0000 +++ b/scripts/plot/__pltopt__.m Fri Jul 26 01:20:46 2002 +0000 @@ -61,6 +61,9 @@ ## @item "#~" ## For boxerrorbars plot style. ## +## @item "#~>" +## For boxxyerrorbars plot style. +## ## @item "n" ## With @code{n} in 1-6 (wraps at 8), plot color ##
--- a/scripts/plot/errorbar.m Thu Jul 25 21:01:16 2002 +0000 +++ b/scripts/plot/errorbar.m Fri Jul 26 01:20:46 2002 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2000, Teemu Ikonen +## Copyright (C) 2000-2002 Teemu Ikonen ## ## This file is part of Octave. ## @@ -116,70 +116,10 @@ usage ("errorbar (...)"); endif - save_hold = ishold; - unwind_protect - if (! ishold) - clg () - endif - hold ("on"); - k = 1; - while (nargin) - a = varargin{k++}; - nargin--; - if (is_vector (a)) - a = a(:); - elseif (is_matrix (a)); - ; - else - usage ("errorbar (...)"); - endif - sz = size (a); - ndata = 1; - arg1 = a; - fmt = " "; - while (nargin) - nargin--; - a = varargin{k++}; - if (isstr (a)) - fmt = a; - cmd = "__errplot__ (arg1"; - for i = 2:ndata, - cmd = [cmd, sprintf(", arg%d",i)]; - endfor - cmd = [cmd, ", fmt);"]; - eval (cmd); - break; - elseif (is_vector (a)) - a = a(:); - elseif (is_matrix (a)) - ; - else - error ("wrong argument types"); - endif - if (size (a) != sz) - error ("argument sizes do not match"); - endif - ndata++; - eval (sprintf ("arg%d = a;", ndata)); - if (ndata > 6) - error ("too many arguments to a plot"); - endif - endwhile - endwhile - - if (! isstr (a)) - fmt = " "; - cmd = "__errplot__(arg1"; - for i = 2:ndata, - cmd = [cmd, sprintf(", arg%d",i)]; - endfor - cmd = [cmd, ", fmt);"]; - eval (cmd); - endif - unwind_protect_cleanup - if (! save_hold) - hold ("off"); - endif - end_unwind_protect + gset nologscale x; + gset nologscale y; + gset nopolar; + + __errcomm__ ("errorbar", varargin); endfunction
--- a/scripts/plot/plot.m Thu Jul 25 21:01:16 2002 +0000 +++ b/scripts/plot/plot.m Fri Jul 26 01:20:46 2002 +0000 @@ -94,21 +94,6 @@ ## @item L ## Set steps plot style. ## -## @item "#" -## For boxes plot style. -## -## @item "~" -## For yerrorbars plot style. -## -## @item ">" -## For xerrorbars plot style. -## -## @item "~>" -## For xyerrorbars plot style. -## -## @item "#~" -## For boxerrorbars plot style. -## ## @item @var{n} ## Interpreted as the plot color if @var{n} is an integer in the range 1 to ## 6.