Plotting Polar Plots using time series data
显示 更早的评论
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 个评论
Mathieu NOE
2025-2-6
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
2025-2-7
Mathieu NOE
2025-2-7
hello Jake
glad I could be of some help !
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Polar Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!








