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

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

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Histograms에 대해 자세히 알아보기

질문:

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