Both the data and output plots are included. If a nonlinear scale for rtick is successfully applied, I can better emphasize rare and extreme events for u>80.
Non-linear Scale for Radius Axis in a Polarhistogram Plot
11 views (last 30 days)
Show older comments
Hsien-Kuan
on 14 Nov 2024
Commented: Hsien-Kuan
on 14 Nov 2024
Could you please guide me on how to adjust the radius axis (rticks and rticklabels) in the polarhistogram plot below to display a non-linear probability scale? Specifically, I’d like to change the linear scale probability P to a non-linear scale such as 1./abs(log10(P)).
It seems that numberOfMeasurements may not be an option that can be modified into nonlinar to make the connection between number of counts and radius (probabiilty). I am doing this nonlinear scale to amplify the rare exteme current u>80 cm/s. Any advice would be greatly appreciated!
TT1=readtable('Table_data.csv');
%% u as current speed and hdg as current heading
u=TT1.Speed_cm_s_;
hdg=TT1.Heading_degrees_;
figure(1)
pax = polaraxes;
c=colormap("cool");
% Current speed u into 5 groups
u_grp=[20 40 60 80 inf];
num_idx=length(u_grp);
c_idx=round(linspace(1,256,num_idx)); % Color indx for 5 groups
% Current Heading (hdg) into 5 groups
hdg5=deg2rad(hdg(u<=max(u)));
hdg4=deg2rad(hdg(u<u_grp(4)));
hdg3=deg2rad(hdg(u<u_grp(3)));
hdg2=deg2rad(hdg(u<u_grp(2)));
hdg1=deg2rad(hdg(u<u_grp(1)));
hold on
polarhistogram(hdg5,deg2rad(0:10:360),'FaceColor',c(c_idx(5),:),'displayname','>80 m/s')
polarhistogram(hdg4,deg2rad(0:10:360),'FaceColor',c(c_idx(4),:),'displayname','60 - 80 m/s')
polarhistogram(hdg3,deg2rad(0:10:360),'FaceColor',c(c_idx(3),:),'displayname','40 - 60 m/s')
polarhistogram(hdg2,deg2rad(0:10:360),'FaceColor',c(c_idx(2),:),'displayname','20 - 40 m/s')
polarhistogram(hdg1,deg2rad(0:10:360),'FaceColor',c(c_idx(1),:)','displayname',' 0 - 20 m/s')
numberOfMeasurement = size(u,1);
p = [5 10 15]/100; % Probability in percentage %
rticks(p*numberOfMeasurement)
rticklabels(strcat(string(p*100),'%'))
pax.ThetaDir = 'clockwise';
pax.ThetaZeroLocation = 'top';
pax.LineWidth=3;
legend('Show')
title('Current speed {\itu} (cm/s)')
set(gca,'FontSize',12,'FontWeight','bold')
Accepted Answer
Walter Roberson
on 14 Nov 2024
polaraxes does not have any way to adjust the scale factor. It does not for example have an RScale property that might (hypothetically) be set to 'log' .
Furthermore, the various axes types that do have *Scale properties only offer to switch between very limited configurations such as 'normal' or 'log' -- nothing as fancy as 1./abs(log10(P))
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!