Plotting Polar Plots using time series data
Afficher commentaires plus anciens
I have time series data for angle and speed (sample attached). I can plot the angel on a polarhistogram as follows.
load("sampleData.mat")
whos
figure
h=polarhistogram(angle);
set(gca,'ThetaTick', [0 30 60 90 120 150 180 210 240 270 300 330], ...
'ThetaTickLabel',{0 30 60 90 120 150 180 210 240 270 300 330})
set(gca,'ThetaZeroLocation','top','ThetaDir','clockwise');
h.DisplayStyle = 'stairs';
But I want to include the speed within the plot too, something similar to a countourf plot or Perfect Polar Plots as below. I tried using the custom function, but I couldn't make it work. How can I do this?

3 commentaires
Mathieu NOE
le 6 Fév 2025
hello
your angle range is very narrow (178 to 180 °) and I suspect that if you want to plot your density on a polar diagram this will be unreadable as the plot will appear as a very narrow area
instead you can still do a density plot in cartesian coordinates
I am using dscatteravailable here : Flow Cytometry Data Reader and Visualization - File Exchange - MATLAB Central

load('sampleData.mat')
% whos
% Name Size Bytes Class Attributes
%
% angle 1x15000 120000 double
% speed 1x15000 120000 double
% time 1x15000 120000 double
figure(1)
[hAxes,col,ctrs1,ctrs2,F] = dscatter(speed(:),angle(:));
xlabel('speed');
ylabel('angle (°)');
grid on
hold on
lb = min(F,[],'all');
ub = max(F,[],'all');
threshold = lb+0.1*(ub-lb); % threshold is 10% of F range above min value
[row,col]=find(F>threshold);
% k = boundary(___,s) specifies shrink factor s using any of the previous syntaxes.
% s is a scalar between 0 and 1. Setting s to 0 gives the convex hull,
% and setting s to 1 gives a compact boundary that envelops the points.
% The default shrink factor is 0.5.
s = 0.75;
k = boundary(row,col,s);
plot(ctrs1(col(k)),ctrs2(row(k)),'r')
hold off
Jake
le 7 Fév 2025
Mathieu NOE
le 7 Fév 2025
hello Jake
glad I could be of some help !
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Polar Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!








