Make polar histogram bins on cardinal axes

5 vues (au cours des 30 derniers jours)
Stephanie Reeves
Stephanie Reeves le 21 Avr 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!

Réponse acceptée

Scott MacKenzie
Scott MacKenzie le 6 Mai 2021
Modifié(e) : Scott MacKenzie le 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.

Plus de réponses (0)

Catégories

En savoir plus sur Data Distribution Plots 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!

Translated by