I would like to connect points in a 3d scatter plot in Matlab that have the same Z value.
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
I’m not sure what you have in mind when you say “connect points”, but here’s a direction:
Alternatively, perhaps you can modify your data and use the
contour3command instead.