Plotting 3D Intersection

2 次查看(过去 30 天)
AR
AR 2019-10-24
评论: AR 2019-10-26
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.

采纳的回答

Shubham Gupta
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
  1 个评论
AR
AR 2019-10-26
Shubham, Thank you. This is exactly the way I was trying to plot the 3D data! Without the zeros even makes it easier to ID those neurons common to both groups! --Allen

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by