how to draw a 3d plot with different color?
1 次查看(过去 30 天)
显示 更早的评论
Hi
I want to assign different color to the specific values in a 3D plot. for example: I have x=[1;2;4;3] y=[1;2;3;4] z=[0.1;0.2;0.3;0.4]
for z>=0.2 scatter3(x,y,z,'b','.') for z=<0.2 scatter3(x,y,z,'g','.')?
thanks
0 个评论
采纳的回答
Rik
2018-1-31
Logical indexing is your answer:
scatter3(x(z>0.2),y(z>0.2),z(z>0.2),'b.')
hold on
scatter3(x(z=<0.2),y(z=<0.2),z(z=<0.2),'g.')
4 个评论
Walter Roberson
2018-1-31
color = repmat('b', size(z));
color(z<0.2) = 'g';
pointsize = 20;
scatter(x, y, pointsize, color);
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!