Plotting 3D Intersection
2 views (last 30 days)
Show older comments
Hi.
Trouble generating a 3D Plot of my data. Would like a simple scatter plot on a x,y,z axis like in plot3 examples. Data attached.
% 'allInters' 36x25 cell-- values are [] or numbers 1,...,300
% 'B2' 36x25x300 double--1s and 0s
% 'B3' 36x25x300 double--numbers 1,...,300
All 3 datasets above are exactly the same, just in different formats
The code below almost seemed to work but instead of 3D, it produces a 2D matrix so appears to collapse one of the dimensions.
%Option Using cellfun w/'allInters'
figure;
hold on
cellfun(@(x) plot(x(:,1),'.'), allInters)
xlim([0 10])
ylim([1 300])
hold off.
Any advice to generate a 3D scatterplot with my data would be appreciated.
Thank you.
0 Comments
Accepted Answer
Shubham Gupta
on 24 Oct 2019
I am not sure how you actually want to plot these values. But one of the way I could think of plotting this data is by using B3:
load('15OctGroupCompare.mat')
[X,Y,Z] = meshgrid(1:25,1:36,1:300);
s = find(B3~=0); % here zeros are ignored for plotting but if want it to include comment out this and successive 3 lines
x = X(s);
y = Y(s);
z = Z(s);
scatter3(x,y,z,5,B3(s))
Finally, you will get 3D plot where X,Y & Z will be colums, rows & depth respectively of B3 array.
I hope this helps, let me know if you have doubts
More Answers (0)
See Also
Categories
Find more on Annotations 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!