Plotting 3D Intersection

2 views (last 30 days)
AR
AR on 24 Oct 2019
Commented: AR on 26 Oct 2019
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.

Accepted Answer

Shubham Gupta
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
  1 Comment
AR
AR on 26 Oct 2019
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

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!