Azzera filtri
Azzera filtri

Make polar histogram bins on cardinal axes

2 visualizzazioni (ultimi 30 giorni)
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!

Risposta accettata

Scott MacKenzie
Scott MacKenzie il 6 Mag 2021
Modificato: Scott MacKenzie il 10 Mag 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.

Più risposte (0)

Categorie

Scopri di più su Data Distribution Plots in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by