# HG changeset patch # User David Bateman # Date 1272407037 -7200 # Node ID 1479b93ee655ef7dfa3849e70aa21491580c2805 # Parent fd6899b1b00eed431db6865d14e4f2cd386c3d04 Respect linestyleorder in errorbar plots diff -r fd6899b1b00e -r 1479b93ee655 scripts/ChangeLog --- a/scripts/ChangeLog Tue Apr 27 21:20:11 2010 +0200 +++ b/scripts/ChangeLog Wed Apr 28 00:23:57 2010 +0200 @@ -1,3 +1,12 @@ +2010-04-27 David Bateman + + * plot/private/__default_plot_options_.m: New option errorstyle. + * plot/private/__pltopt__.m: Use errorstyle here seperately from + the linestyle so that both can be set. + * plot/private/__errcomm__.m: Allow for the fact that matrices + to __errplot__ with return a vector of handles. + * plot/private/__errplot__.m: Allow for default linestyles. + 2010-04-26 David Bateman * plot/bar.m: Document the use of the colormap for the color of diff -r fd6899b1b00e -r 1479b93ee655 scripts/plot/private/__default_plot_options__.m --- a/scripts/plot/private/__default_plot_options__.m Tue Apr 27 21:20:11 2010 +0200 +++ b/scripts/plot/private/__default_plot_options__.m Wed Apr 28 00:23:57 2010 +0200 @@ -29,5 +29,6 @@ options.color = []; options.linestyle = []; options.marker = []; + options.errorstyle = []; endfunction diff -r fd6899b1b00e -r 1479b93ee655 scripts/plot/private/__errcomm__.m --- a/scripts/plot/private/__errcomm__.m Tue Apr 27 21:20:11 2010 +0200 +++ b/scripts/plot/private/__errcomm__.m Wed Apr 28 00:23:57 2010 +0200 @@ -32,9 +32,8 @@ endif nargs = length (varargin); - + retval = []; k = 1; - idx = 1; data = cell(6,1); while (k <= nargs) a = varargin{k++}; @@ -51,7 +50,7 @@ while (k <= nargs) a = varargin{k++}; if (ischar (a) || iscellstr (a)) - retval(idx++) = __errplot__ (a, p, data{1:ndata}); + retval = [retval; __errplot__(a, p, data{1:ndata})]; break; elseif (isvector (a)) a = a(:); @@ -71,7 +70,7 @@ endwhile if (! (ischar (a) || iscellstr (a))) - retval(idx++) = __errplot__ ("~", p, data{1:ndata}); + retval = [retval; __errplot__("~", p, data{1:ndata})]; endif drawnow (); diff -r fd6899b1b00e -r 1479b93ee655 scripts/plot/private/__errplot__.m --- a/scripts/plot/private/__errplot__.m Tue Apr 27 21:20:11 2010 +0200 +++ b/scripts/plot/private/__errplot__.m Wed Apr 28 00:23:57 2010 +0200 @@ -40,26 +40,20 @@ for i = 1:nplots ## Set the plot type based on linestyle. - if (strcmp (fmt.linestyle, "~")) + if (strcmp (fmt.errorstyle, "~")) ifmt = "yerr"; - elseif (strcmp (fmt.linestyle, ">")) + elseif (strcmp (fmt.errorstyle, ">")) ifmt = "xerr"; - elseif (strcmp (fmt.linestyle, "~>")) + elseif (strcmp (fmt.errorstyle, "~>")) ifmt = "xyerr"; - elseif (strcmp (fmt.linestyle, "#")) + elseif (strcmp (fmt.errorstyle, "#")) ifmt = "box"; - elseif (strcmp (fmt.linestyle, "#~")) + elseif (strcmp (fmt.errorstyle, "#~")) ifmt = "boxy"; elseif (strcmp (fmt.linestyle, "#~>")) ifmt = "boxxy"; else - ifmt = "matlab"; - endif - - if (! isempty (fmt.marker) && ! strcmp (fmt.marker, "none")) - mrk = fmt.marker; - else - mrk = "none"; + ifmt = "~"; endif hg = hggroup ("parent", p); @@ -67,16 +61,22 @@ args = __add_datasource__ ("__errplot__", hg, {"x", "y", "l", "u", "xl", "xu"}); - if (isempty (fmt.color)) - hl = __line__ (hg, "color", __next_line_color__ (), "marker", mrk); + if (isempty (fmt.marker) && isempty (fmt.linestyle)) + [linestyle, marker] = __next_line_style__ (); + if (isempty (fmt.color)) + hl = __line__ (hg, "linestyle", linestyle, "marker", marker, + "color", __next_line_color__ ()) + else + hl = __line__ (hg, "linestyle", linestyle, "marker", marker, + "color", fmt.color) + endif else - hl = __line__ (hg, "color", fmt.color, "marker", mrk); - endif - - if (index (ifmt, "matlab")) - ifmt = "yerr"; - if (! isempty (fmt.linestyle) && ! strcmp (fmt.linestyle, "none")) - set (hl, "linestyle", fmt.linestyle); + if (isempty (fmt.color)) + hl = __line__ (hg, "linestyle", fmt.linestyle, "marker", fmt.marker, + "color", __next_line_color__ ()) + else + hl = __line__ (hg, "linestyle", fmt.linestyle, "marker", fmt.marker, + "color", fmt.color) endif endif @@ -171,7 +171,7 @@ "color", get (hl, "color"), "linewidth", get (hl, "linewidth"), "linestyle", get (hl, "linestyle"), - "marker", mrk, "parent", hg); + "marker", get (hl, "marker"), "parent", hg); endfor endfunction diff -r fd6899b1b00e -r 1479b93ee655 scripts/plot/private/__pltopt__.m --- a/scripts/plot/private/__pltopt__.m Tue Apr 27 21:20:11 2010 +0200 +++ b/scripts/plot/private/__pltopt__.m Wed Apr 28 00:23:57 2010 +0200 @@ -157,9 +157,10 @@ else n = 0; endif - options.linestyle = opt(1:n); + options.errorstyle = opt(1:n); opt(1:n) = []; - have_linestyle = true; + else + options.errorstyle = "~"; endif while (! isempty (opt))