How to plot the 3D spherical histogram?
10 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello,
I have a set of normal directions in 3D and I want to plot the histogram. But seem matlab only have 2D option. Is there any method I could have a plot like the attached figure? Or any other software could solve the problem?
Thanks a lot!

1 Commento
YONG TANG
il 17 Mar 2020
hi pei,
did you solve this problem?
recently, I'm also trying to plot some figures like what you mentioned.
could you give me some suggestions?
best,
yong
Risposte (1)
darova
il 21 Feb 2020
You can create it manually
clc,clear
v = rand(10,3)*2-1;
v0 = v(:,1)*0;
quiver3(v0,v0,v0,v(:,1),v(:,2),v(:,3),1)
axis equal
hold on
[ph,th,r] = cart2sph(v(:,1),v(:,2),v(:,3));
[X,Y,Z] = deal(zeros(4));
for i = 1:size(v,1)
ph1 = ph(i) + pi/180*[-1 1 -1 1]*5; % azimuth phi
th1 = th(i) + pi/180*[1 1 -1 -1]*5; % elevation theta
[x1,y1,z1] = sph2cart(ph1,th1,r(i));
X([6 7 10 11]) = x1;
Y([6 7 10 11]) = y1;
Z([6 7 10 11]) = z1;
surf(X,Y,Z,'facecolor',rand(1,3))
pause(0.5)
end
hold off
alpha(0.5)
1 Commento
darova
il 21 Feb 2020
Set color according to radius
cmap = jet(50);
for i = 1:size(v,1)
%% ...
ix = round(r(i)/max(r)*49)+1;
surf(X,Y,Z,'facecolor',cmap(ix,:))
pause(0.5)
end

Vedere anche
Categorie
Scopri di più su Histograms in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!