# HG changeset patch # User Jaroslav Hajek # Date 1263243979 -3600 # Node ID 614ad9e7a17bd0135d2ebe4f4d4e70203dcc35ef # Parent 28af9aa6f9ed769d29f109fc64ae1a2931f81f8d use patches again in scatter plots diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,8 @@ +2010-01-11 Jaroslav Hajek + + * plot/private/__scatter__.m: Use patch objects instead of lines, + switch at 100 points. + 2010-01-11 Jaroslav Hajek * plot/private/__scatter__.m: Fix typos. diff --git a/scripts/plot/private/__scatter__.m b/scripts/plot/private/__scatter__.m --- a/scripts/plot/private/__scatter__.m +++ b/scripts/plot/private/__scatter__.m @@ -120,7 +120,7 @@ addlistener (hg, "cdata", @update_data); addlistener (hg, "sizedata", @update_data); - if (numel (x) <= 20) + if (numel (x) <= 100) ## For small number of points, we'll construct an object for each point. @@ -130,9 +130,10 @@ if (ischar (c)) for i = 1 : numel (x) - h = __go_line__ (hg, "xdata", x(i), "ydata", y(i), "zdata", z(i,:), - "color", c, "marker", marker, - "markersize", s(i), "linestyle", "none"); + h = __go_patch__ (hg, "xdata", x(i), "ydata", y(i), "zdata", z(i,:), + "faces", 1, "vertices", [x(i), y(i), z(i,:)], + "facecolor", "none", "edgecolor", c, "marker", marker, + "markersize", s(i), "linestyle", "none"); if (filled) set(h, "markerfacecolor", c); endif @@ -143,11 +144,14 @@ endif for i = 1 : numel (x) - h = __go_line__ (hg, "xdata", x(i), "ydata", y(i), "zdata", z(i,:), - "color", c(i,:), "marker", marker, - "markersize", s(i), "linestyle", "none"); + h = __go_patch__ (hg, "xdata", x(i), "ydata", y(i), "zdata", z(i,:), + "faces", 1, "vertices", [x(i), y(i), z(i,:)], + "facecolor", "none", "edgecolor", "flat", + "cdata", c(i,:), + "marker", marker, "markersize", s(i), + "linestyle", "none"); if (filled) - set(h, "markerfacecolor", c(i,:)); + set(h, "markerfacecolor", "flat"); endif endfor endif @@ -236,11 +240,24 @@ x = vert(:,1); y = vert(:,2); z = vert(:,3:end); - h = __go_line__ (hg, "xdata", x, "ydata", y, "zdata", z, - "color", c, "marker", marker, - "markersize", s, "linestyle", "none"); - if (filled) - set(h, "markerfacecolor", c); + if (ischar (c)) + h = __go_patch__ (hg, "xdata", x, "ydata", y, "zdata", z, + "faces", 1, "vertices", vert, + "facecolor", "none", "edgecolor", c, "marker", marker, + "markersize", s, "linestyle", "none"); + if (filled) + set(h, "markerfacecolor", c); + endif + else + h = __go_patch__ (hg, "xdata", x, "ydata", y, "zdata", z, + "faces", 1, "vertices", vert, + "facecolor", "none", "edgecolor", "flat", + "cdata", c, + "marker", marker, "markersize", s, + "linestyle", "none"); + if (filled) + set(h, "markerfacecolor", "flat"); + endif endif else ## FIXME: round the size to one decimal place. It's not quite right, though.