Mercurial > hg > octave-lojdl
changeset 10236:8e58c402ebb2
Accelerate colormap colored scatter plots
author | David Bateman <dbateman@free.fr> |
---|---|
date | Mon, 01 Feb 2010 20:17:34 +0100 |
parents | c022ff4a2b14 |
children | f2d3e71b2001 |
files | scripts/ChangeLog scripts/plot/__go_draw_axes__.m scripts/plot/private/__scatter__.m |
diffstat | 3 files changed, 63 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,10 @@ +2010-02-01 David Bateman <dbateman@free.fr> + + * plot/private/__scatter__.m: Treat "flat" colored patches as + a single patch. + * plot/__go_draw_axes__.m: If a patch object is flat, treat its + outline with the gnuplot "palette". + 2010-01-30 Thorsten Meyer <thorsten.meyier@gmx.de> * statistics/tests/kruskal_wallis_test.m: Replace chisquare_cdf
--- a/scripts/plot/__go_draw_axes__.m +++ b/scripts/plot/__go_draw_axes__.m @@ -762,16 +762,23 @@ if (numel(ccol) == 3) color = ccol; else - r = 1 + round ((size (cmap, 1) - 1) - * (ccol - clim(1))/(clim(2) - clim(1))); - r = max (1, min (r, size (cmap, 1))); - color = cmap(r, :); + if (isscalar (ccol)) + ccol = repmat(ccol, numel (xcol), 1); + endif + color = "flat"; + have_cdata(data_idx) = true; endif elseif (strncmp (ec, "interp", 6)) - warning ("\"interp\" not supported, using 1st entry of cdata"); - r = 1 + round ((size (cmap, 1) - 1) * ccol(1)); - r = max (1, min (r, size (cmap, 1))); - color = cmap(r,:); + if (numel(ccol) == 3) + warning ("\"interp\" not supported, using 1st entry of cdata"); + color = ccol(1,:); + else + if (isscalar (ccol)) + ccol = repmat(ccol, numel (xcol), 1); + endif + color = "interp"; + have_cdata(data_idx) = true; + endif endif elseif (isnumeric (ec)) color = ec; @@ -859,8 +866,12 @@ if (mono) colorspec = ""; else - colorspec = sprintf ("lc rgb \"#%02x%02x%02x\"", - round (255*color)); + if (ischar (color)) + colorspec = "palette"; + else + colorspec = sprintf ("lc rgb \"#%02x%02x%02x\"", + round (255*color)); + endif endif sidx = 1; @@ -993,20 +1004,40 @@ withclause{data_idx} = tmpwith{1}; endif if (nd == 3) - if (! isnan (xcol) && ! isnan (ycol) && ! isnan (zcol)) - data{data_idx} = [[xcol; xcol(1)], [ycol; ycol(1)], ... - [zcol; zcol(1)]]'; - else - data{data_idx} = [xcol, ycol, zcol]'; - endif - usingclause{data_idx} = sprintf ("record=%d using ($1):($2):($3)", columns (data{data_idx})); + if (ischar (color)) + if (! isnan (xcol) && ! isnan (ycol) && ! isnan (zcol)) + data{data_idx} = [[xcol; xcol(1)], [ycol; ycol(1)], ... + [zcol; zcol(1)], [ccol; ccol(1)]]'; + else + data{data_idx} = [xcol, ycol, zcol, ccol]'; + endif + usingclause{data_idx} = sprintf ("record=%d using ($1):($2):($3):($4)", columns (data{data_idx})); + else + if (! isnan (xcol) && ! isnan (ycol) && ! isnan (zcol)) + data{data_idx} = [[xcol; xcol(1)], [ycol; ycol(1)], ... + [zcol; zcol(1)]]'; + else + data{data_idx} = [xcol, ycol, zcol]'; + endif + usingclause{data_idx} = sprintf ("record=%d using ($1):($2):($3)", columns (data{data_idx})); + endif else - if (! isnan (xcol) && ! isnan (ycol)) - data{data_idx} = [[xcol; xcol(1)], [ycol; ycol(1)]]'; - else - data{data_idx} = [xcol, ycol]'; - endif - usingclause{data_idx} = sprintf ("record=%d using ($1):($2)", columns (data{data_idx})); + if (ischar (color)) + if (! isnan (xcol) && ! isnan (ycol)) + data{data_idx} = [[xcol; xcol(1)], [ycol; ycol(1)], ... + [ccol; ccol(1)]]'; + else + data{data_idx} = [xcol, ycol, ccol]'; + endif + usingclause{data_idx} = sprintf ("record=%d using ($1):($2):($3)", columns (data{data_idx})); + else + if (! isnan (xcol) && ! isnan (ycol)) + data{data_idx} = [[xcol; xcol(1)], [ycol; ycol(1)]]'; + else + data{data_idx} = [xcol, ycol]'; + endif + usingclause{data_idx} = sprintf ("record=%d using ($1):($2)", columns (data{data_idx})); + endif endif if (length (tmpwith) > 1)
--- a/scripts/plot/private/__scatter__.m +++ b/scripts/plot/private/__scatter__.m @@ -185,6 +185,8 @@ if (ischar (c) || rows (c) == 1) h = render_size_color (hg, vert, s, c, marker, filled, false); + elseif (columns (c) == 1) + h = render_size_color (hg, vert, s, c, marker, filled, true); else [cc, idx] = unique_idx (c, "rows"); if (isscalar (s)) @@ -199,7 +201,6 @@ endfor endif endif - endif if (! ischar (c) && rows (c) > 1)