Creating a polar histogram with x values (bins) that will appear on the graph even though no values fall into those bins?
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Steven Lord
2023-5-31
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!