Plotting 3D Intersection
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Shubham Gupta
2019-10-24
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
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!