문제

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)

enter image description here

More information in the documentation.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top