Shai Zarzewski
Shai Zarzewski

Reputation: 1698

visualizing 3d data volume in matlab

I have many points in 3d (x,y,z), and for each point I have it's disparity (0-10 value), different points can have the same disparity.

I want to plot this data that each point will have a color according to it's disparity.

I want it to be something like this picture: (small disparity will have one color, and as it's gets bigger the color changes)

enter image description here

how can I do it?

Upvotes: 3

Views: 132

Answers (1)

Luis Mendo
Luis Mendo

Reputation: 112659

Use scatter3:

x = rand(1,1000);
y = rand(1,1000);
z = rand(1,1000); %// example x, y, z
d = x.^2+y.^2+z.^2; %// example disparity
scatter3(x,y,z,8,d,'fill');
colorbar

The fourth input argument to scatter3 is marker size. The fifth determines color. 'fill' uses filled markers.

enter image description here

Upvotes: 4

Related Questions