comparison scripts/plot/private/__scatter__.m @ 10083:614ad9e7a17b

use patches again in scatter plots
author Jaroslav Hajek <highegg@gmail.com>
date Mon, 11 Jan 2010 22:06:19 +0100
parents 28af9aa6f9ed
children 4516a0c97ced
comparison
equal deleted inserted replaced
10082:28af9aa6f9ed 10083:614ad9e7a17b
118 addlistener (hg, "ydata", @update_data); 118 addlistener (hg, "ydata", @update_data);
119 addlistener (hg, "zdata", @update_data); 119 addlistener (hg, "zdata", @update_data);
120 addlistener (hg, "cdata", @update_data); 120 addlistener (hg, "cdata", @update_data);
121 addlistener (hg, "sizedata", @update_data); 121 addlistener (hg, "sizedata", @update_data);
122 122
123 if (numel (x) <= 20) 123 if (numel (x) <= 100)
124 124
125 ## For small number of points, we'll construct an object for each point. 125 ## For small number of points, we'll construct an object for each point.
126 126
127 if (numel (s) == 1) 127 if (numel (s) == 1)
128 s = repmat (s, numel(x), 1); 128 s = repmat (s, numel(x), 1);
129 endif 129 endif
130 130
131 if (ischar (c)) 131 if (ischar (c))
132 for i = 1 : numel (x) 132 for i = 1 : numel (x)
133 h = __go_line__ (hg, "xdata", x(i), "ydata", y(i), "zdata", z(i,:), 133 h = __go_patch__ (hg, "xdata", x(i), "ydata", y(i), "zdata", z(i,:),
134 "color", c, "marker", marker, 134 "faces", 1, "vertices", [x(i), y(i), z(i,:)],
135 "markersize", s(i), "linestyle", "none"); 135 "facecolor", "none", "edgecolor", c, "marker", marker,
136 "markersize", s(i), "linestyle", "none");
136 if (filled) 137 if (filled)
137 set(h, "markerfacecolor", c); 138 set(h, "markerfacecolor", c);
138 endif 139 endif
139 endfor 140 endfor
140 else 141 else
141 if (rows (c) == 1) 142 if (rows (c) == 1)
142 c = repmat (c, numel (x), 1); 143 c = repmat (c, numel (x), 1);
143 endif 144 endif
144 145
145 for i = 1 : numel (x) 146 for i = 1 : numel (x)
146 h = __go_line__ (hg, "xdata", x(i), "ydata", y(i), "zdata", z(i,:), 147 h = __go_patch__ (hg, "xdata", x(i), "ydata", y(i), "zdata", z(i,:),
147 "color", c(i,:), "marker", marker, 148 "faces", 1, "vertices", [x(i), y(i), z(i,:)],
148 "markersize", s(i), "linestyle", "none"); 149 "facecolor", "none", "edgecolor", "flat",
150 "cdata", c(i,:),
151 "marker", marker, "markersize", s(i),
152 "linestyle", "none");
149 if (filled) 153 if (filled)
150 set(h, "markerfacecolor", c(i,:)); 154 set(h, "markerfacecolor", "flat");
151 endif 155 endif
152 endfor 156 endfor
153 endif 157 endif
154 158
155 else 159 else
234 function h = render_size_color(hg, vert, s, c, marker, filled) 238 function h = render_size_color(hg, vert, s, c, marker, filled)
235 if (isscalar (s)) 239 if (isscalar (s))
236 x = vert(:,1); 240 x = vert(:,1);
237 y = vert(:,2); 241 y = vert(:,2);
238 z = vert(:,3:end); 242 z = vert(:,3:end);
239 h = __go_line__ (hg, "xdata", x, "ydata", y, "zdata", z, 243 if (ischar (c))
240 "color", c, "marker", marker, 244 h = __go_patch__ (hg, "xdata", x, "ydata", y, "zdata", z,
241 "markersize", s, "linestyle", "none"); 245 "faces", 1, "vertices", vert,
242 if (filled) 246 "facecolor", "none", "edgecolor", c, "marker", marker,
243 set(h, "markerfacecolor", c); 247 "markersize", s, "linestyle", "none");
248 if (filled)
249 set(h, "markerfacecolor", c);
250 endif
251 else
252 h = __go_patch__ (hg, "xdata", x, "ydata", y, "zdata", z,
253 "faces", 1, "vertices", vert,
254 "facecolor", "none", "edgecolor", "flat",
255 "cdata", c,
256 "marker", marker, "markersize", s,
257 "linestyle", "none");
258 if (filled)
259 set(h, "markerfacecolor", "flat");
260 endif
244 endif 261 endif
245 else 262 else
246 ## FIXME: round the size to one decimal place. It's not quite right, though. 263 ## FIXME: round the size to one decimal place. It's not quite right, though.
247 [ss, idx] = unique_idx (ceil (s*10) / 10); 264 [ss, idx] = unique_idx (ceil (s*10) / 10);
248 for i = 1:rows (ss) 265 for i = 1:rows (ss)