MATLAB: Scatter3 with weights

heatmapscatterplot

Hi,
I want to make a scatterplot of x, y, z coordinates and include the weight (which differs per particle) the locations have. So every particle has a specific weight and I want to combine all the weight of all the particles that have the same coordinates and visualize it as a heat plot. Is this possible?
Thanks!

Best Answer

You could pass color values as follows
n = 1000;
X = rand(n, 1); Y = rand(n, 1); Z = rand(n, 1); C = hypot(X, Y);
size = 500;
scatter3(X, Y, Z, size, C, '.');
colormap jet
Or do you want to take a slice along the xy-plane? Then you should probably look at this page .