我想在Matlab中连接具有相同Z值的三维散点图中的点。
num=1e2;
x=rand(num,1);
y=rand(num,1);
z=zeros(num,1);
z(randsample(num,.25*num),:)=1;
scatter3(x,y,z);hold on;scatter3(x1,y1,z1);hold on;
%connect dots with same Z value, so there should be horizontal line between points in the same Z plane
答案 0 :(得分:0)
当你说“连接点”时,我不确定你的想法,但这是一个方向:
figure, hold on
for u = unique(z(:))'
plot3(x(z == u), y(z == u), z(z == u))
end
view(-37.5, 30)
或者,您可以修改数据并改为使用contour3
命令。