3D plot, draw (X,Y,Z,value)
4 views (last 30 days)
Show older comments
how to performe a plot like contours (X,Y,Z,Value)
I have a set of data
for example
(1,1,1)=5
(1,1,2)=7
(1,2,1)=6
i want to plot it like a 3D with legend
Sample for the data
X Y Z Value
1 1 0.000 1.000
1 1 0.005 2.000
1 1 0.010 3.000
1 1 0.015 4.000
1 1 0.020 5.000
1 1 0.025 6.000
1 2 0.000 7.000
1 2 0.005 8.000
1 2 0.010 9.000
1 2 0.015 10.000
1 2 0.020 11.000
1 2 0.025 12.000
i 3 0.000 13.000
1 3 0.005 14.000
1 3 0.010 15.000
1 3 0.015 16.000
1 3 0.020 17.000
1 3 0.025 18.000
2 1 0.000 19.000
2 1 0.005 20.000
2 1 0.010 21.000
2 1 0.015 22.000
2 1 0.020 23.000
2 1 0.025 24.000
2 2 0.000 25.000
2 2 0.005 26.000
2 2 0.010 27.000
2 2 0.015 28.000
2 2 0.020 29.000
2 2 0.025 30.000
2 3 0.000 31.000
2 3 0.005 32.000
2 3 0.010 33.000
2 3 0.015 34.000
2 3 0.020 35.000
2 3 0.025 36.000
2 Comments
Star Strider
on 27 Aug 2022
This does not make sense to me.
I’m posting this in the event someone else may have some insight into it —
xyzv = [ 1 1 0.000 1.000
1 1 0.005 2.000
1 1 0.010 3.000
1 1 0.015 4.000
1 1 0.020 5.000
1 1 0.025 6.000
1 2 0.000 7.000
1 2 0.005 8.000
1 2 0.010 9.000
1 2 0.015 10.000
1 2 0.020 11.000
1 2 0.025 12.000
1 3 0.000 13.000
1 3 0.005 14.000
1 3 0.010 15.000
1 3 0.015 16.000
1 3 0.020 17.000
1 3 0.025 18.000
2 1 0.000 19.000
2 1 0.005 20.000
2 1 0.010 21.000
2 1 0.015 22.000
2 1 0.020 23.000
2 1 0.025 24.000
2 2 0.000 25.000
2 2 0.005 26.000
2 2 0.010 27.000
2 2 0.015 28.000
2 2 0.020 29.000
2 2 0.025 30.000
2 3 0.000 31.000
2 3 0.005 32.000
2 3 0.010 33.000
2 3 0.015 34.000
2 3 0.020 35.000
2 3 0.025 36.000 ];
Xm = reshape(xyzv(:,1),6,[])
Ym = reshape(xyzv(:,2),6,[])
Zm = reshape(xyzv(:,3),6,[])
Vm = reshape(xyzv(:,4),6,[])
figure
surf(Xm,Ym,Zm)
colormap(turbo(5))
.
dpb
on 27 Aug 2022
Perhaps @John D'Errico's <HighDimensionalPlottingIssues> will be of some conceptual benefit to the poster...
Answers (1)
Chunru
on 28 Aug 2022
Edited: Chunru
on 28 Aug 2022
You can use scatter3 with marker size/color to represent value, though it is not a contour.
xyzv = [ 1 1 0.000 1.000
1 1 0.005 2.000
1 1 0.010 3.000
1 1 0.015 4.000
1 1 0.020 5.000
1 1 0.025 6.000
1 2 0.000 7.000
1 2 0.005 8.000
1 2 0.010 9.000
1 2 0.015 10.000
1 2 0.020 11.000
1 2 0.025 12.000
1 3 0.000 13.000
1 3 0.005 14.000
1 3 0.010 15.000
1 3 0.015 16.000
1 3 0.020 17.000
1 3 0.025 18.000
2 1 0.000 19.000
2 1 0.005 20.000
2 1 0.010 21.000
2 1 0.015 22.000
2 1 0.020 23.000
2 1 0.025 24.000
2 2 0.000 25.000
2 2 0.005 26.000
2 2 0.010 27.000
2 2 0.015 28.000
2 2 0.020 29.000
2 2 0.025 30.000
2 3 0.000 31.000
2 3 0.005 32.000
2 3 0.010 33.000
2 3 0.015 34.000
2 3 0.020 35.000
2 3 0.025 36.000 ];
% Use scatter3
scatter3(xyzv(:,1), xyzv(:,2), xyzv(:,3), xyzv(:,4), xyzv(:,4))
colorbar
0 Comments
See Also
Categories
Find more on Data Distribution Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!