Make polar histogram bins on cardinal axes

7 次查看(过去 30 天)
I am making a polar histogram showing eye movement directions. I would like each bin to represent each tick rather than representing the directions between the ticks. It is correct at 0, but incorrect at 90, 180, and 270, as shown here. How do I change it so that the bins represent cardinal directions at 0, 90, 180, and 270?
My code is very simple, the line is simply: "polarhistogram(saccade.AngularDirections,15)" where saccade is a table, and AngularDirections is a column of numbers with different directions in radians.
Thank you in advance!

采纳的回答

Scott MacKenzie
Scott MacKenzie 2021-5-6
编辑:Scott MacKenzie 2021-5-10
Consider specifying bin edges rather than the number of bins. If you want four bins centered at 0, 90, 180, and 270, then you need to specify five edges. In the example below, the edges are 0 90 180 270 360, but offset by 45 degrees. This gives you four bins centered at 0, 90, 180, and 270 degrees. Is that what you want?
% test data
y = 2*pi * rand(1,100);
edges = (0:90:360) + 45;
edges = deg2rad(edges);
polarhistogram(y, edges);
Additional details are in my answer to this question, which you had commented on.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Distribution Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by