Ploting (x,z) and (y,z) data on same plot

2 views (last 30 days)
Hi i have multiple (x,z) and (y,z) grid data. I want to plot them on the same axis in 3D. The x and y meaurements are separated by 1 meters apart as shown in the picture attached. I am also attaching my data. Any leads for this will be appreciated. Thank you.
  1 Comment
Kabit Kishore
Kabit Kishore on 18 Feb 2022
I have managed to plot line x0 and y0. However i want to plot the rest of line on this same plot which are separated by 1 meters interval in both x and y directions. This is what i have done.
scatter3(x,zeros(size(x)),z)
hold on
scatter3(zeros(size(y)),y,z1)

Sign in to comment.

Accepted Answer

Kevin Holly
Kevin Holly on 18 Feb 2022
Edited: Kevin Holly on 18 Feb 2022
I'm not sure what you mean by the x and y measurements being separated by 1 meter. Below is a guess at want you want. Please clarifiy.
x0 = readtable('x0.xlsx');
x1 = readtable('x1.xlsx');
y0 = readtable('y0.xlsx');
y1 = readtable('y1.xlsx');
plot3(x0.x,zeros(length(x0.x)),x0.z)
hold on
plot3(x1.x,ones(length(x1.x)),x1.z)
plot3(zeros(length(y0.y)),y0.y,y0.z)
plot3(ones(length(y1.y)),y1.y,y1.z)
xlabel('x')
ylabel('y')
zlabel('z')
  3 Comments
Kevin Holly
Kevin Holly on 22 Feb 2022
x0 = readtable('x0.xlsx');
x1 = readtable('x1.xlsx');
y0 = readtable('y0.xlsx');
y1 = readtable('y1.xlsx');
Colorimage = zeros(max(length(y0.y),length(y1.y)),max(length(x0.x),length(x1.x)));
Colorimage(length(y0.z)-1,:)=x0.z;% made it one off so it displays color
Colorimage(length(y0.z)-100,1:length(x1.x))=x1.z;
Colorimage(:,length(x0.z)-1)=y0.z;% made it one off so it displays color
Colorimage(1:length(y1.y),length(x0.z)-100)=y1.z;
surf(Colorimage)
h=gca;
h.Children.EdgeColor ='none';
h.Children.XData = x0.x;
h.Children.YData = y0.y;
xlabel('x')
ylabel('y')
zlabel('z')
colorbar
figure(2)
Colorimage = zeros(max(length(y0.y),length(y1.y)),max(length(x0.x),length(x1.x)));
Colorimage(length(y0.z)-23,:)=x0.z;% shifted to make visible
Colorimage(length(y0.z)-100,1:length(x1.x))=x1.z;
Colorimage(:,length(x0.z))=y0.z;
Colorimage(1:length(y1.y),length(x0.z)-100)=y1.z;
imagesc(fliplr(Colorimage))
xlabel('x')
ylabel('y')
colorbar
axis off

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!