How to plot the 3D spherical histogram?

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 件のコメント

YONG TANG
YONG TANG 2020 年 3 月 17 日
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

サインインしてコメントする。

回答 (1 件)

darova
darova 2020 年 2 月 21 日

0 投票

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 件のコメント

darova
darova 2020 年 2 月 21 日
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

サインインしてコメントする。

カテゴリ

質問済み:

2020 年 2 月 21 日

コメント済み:

2020 年 3 月 17 日

Community Treasure Hunt

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

Start Hunting!

Translated by