Mercurial > hg > octave-nkf
changeset 10580:1479b93ee655
Respect linestyleorder in errorbar plots
author | David Bateman <dbateman@free.fr> |
---|---|
date | Wed, 28 Apr 2010 00:23:57 +0200 |
parents | fd6899b1b00e |
children | e2a4e87b900c |
files | scripts/ChangeLog scripts/plot/private/__default_plot_options__.m scripts/plot/private/__errcomm__.m scripts/plot/private/__errplot__.m scripts/plot/private/__pltopt__.m |
diffstat | 5 files changed, 38 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,12 @@ +2010-04-27 David Bateman <dbateman@free.fr> + + * 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 <dbateman@free.fr> * plot/bar.m: Document the use of the colormap for the color of
--- a/scripts/plot/private/__default_plot_options__.m +++ b/scripts/plot/private/__default_plot_options__.m @@ -29,5 +29,6 @@ options.color = []; options.linestyle = []; options.marker = []; + options.errorstyle = []; endfunction
--- a/scripts/plot/private/__errcomm__.m +++ b/scripts/plot/private/__errcomm__.m @@ -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 ();
--- a/scripts/plot/private/__errplot__.m +++ b/scripts/plot/private/__errplot__.m @@ -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