Creating a polar histogram with x values (bins) that will appear on the graph even though no values fall into those bins?
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
James Baldassano
le 31 Mai 2023
Commenté : James Baldassano
le 31 Mai 2023
I am trying to make a polar histogram of values that actually are measured angles of axons exiting a brain structure (they are all measured in 2D). Essentially, these angles are all roughly between 1-270 degrees, but there are no measurements between 270 & 360. I have attached a histogram made of the data. My goal is to essentially "wrap" this histogram around a circle, but since there are no values for the last 1/4 of the x values, I'm not sure how to tell MATLAB that "there needs to be an empty section on this histogram at the end."
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1399309/image.jpeg)
Thank you!
0 commentaires
Réponse acceptée
Steven Lord
le 31 Mai 2023
x = deg2rad(randi([0 270], 1, 1e6));
polarhistogram(x);
If not, just call histogram with a vector of bin edges and/or specifying the BinLimits name-value argument.
x = rand(1, 1e6);
h = histogram(x, 0:0.25:2);
h.BinEdges.'
Even though there's no data greater than 1, because I specified the bin edges that's what histogram used.
figure
h = histogram(x, 'NumBins', 16, 'BinLimits', [0 2]);
h.BinEdges.'
16 equal width bins spanning from 0 to 2.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Annotations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!