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!