Make polar histogram bins on cardinal axes

3 Ansichten (letzte 30 Tage)
Stephanie Reeves
Stephanie Reeves am 21 Apr. 2021
Bearbeitet: Scott MacKenzie am 10 Mai 2021
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!

Akzeptierte Antwort

Scott MacKenzie
Scott MacKenzie am 6 Mai 2021
Bearbeitet: Scott MacKenzie am 10 Mai 2021
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.

Weitere Antworten (0)

Kategorien

Mehr zu Data Distribution Plots 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!

Translated by