I am plotting a depth image (RGBD) as a scatter graph, using scatter3(x,y,z)
in matlab.
How can I set a colormap on the scatter3 plot where the color is dependent on the z-value?
Thanks
Do you actually want a 3D-Visuasation?
Then use scatter3
as follows:
scatter3(x,y,z,[],z)
where []
can be any number specifying the size of your circles, otherwise the default 36 is used.
If you just want to use z
as definition for the color, use the simple scatter
scatter(x,y,[],z)
you can set the colormap as usual:
colormap(hot)
Example:
[X,Y,Z] = sphere(16);
x = [0.5*X(:); 0.75*X(:); X(:)];
y = [0.5*Y(:); 0.75*Y(:); Y(:)];
z = [0.5*Z(:); 0.75*Z(:); Z(:)];
scatter3(x,y,z,[],z)
colormap(hot)