Histogram with circular bars
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi, I have data grouped into 100x3 and 100x4 matrices. Each matrix column refers to different types of measured angles, e.g. alpha, beta and so on. I prepared single polar histogram for first angle:
A = [160 65 200; 145 75 225; 160 50 250; 120 70 220]; % shortened version of one of 3-column matrices
[N, bin] = histcounts(A(:,1), 10, 'Normalization','probability');
minData = min(min(N));
maxData = max(max(N));
f = figure;
p1 = polarhistogram(A(:,1),10, 'Normalization','probability','FaceColor', 'b');
colorbar;
caxis([minData maxData]);
How can I plot content of each matrix into one polar probability histogram with concentric bins respective for each angle? I can't find out how to add other circular bins for subsequent angles. I would like to create something similar to this plot:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/242006/image.png)
I will be very grateful for any advice and help.
0 Kommentare
Antworten (1)
Bjorn Gustavsson
am 10 Okt. 2019
I would do something like this:
edges = 0:15:360;
N_all(1,:) = histcounts(M1,edges);% Put one histogram per row into N_all
N_all(2,:) = histcounts(M2,edges);
N_all(3,:) = histcounts(M3,edges);
N_all(4,:) = histcounts(M4,edges);
N_all(5,:) = N_all(4,:); % Replicate the last row
R = 1:5; % some arbitrary radial coordinates
theta = edges*pi/180; % angles in radians
try
polarPcolor(theta*180/pi,R,N_all),shading flat
catch
disp('You can find the polarPcolor function on the file exchange')
[theta,R] = meshgrid(theta,R);
pcolor(R.*cos(theta),R.*sin(theta),N_all),shading flat
end
HTH
0 Kommentare
Siehe auch
Kategorien
Mehr zu Annotations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!