Non-linear Scale for Radius Axis in a Polarhistogram Plot

58 ビュー (過去 30 日間)
Hsien-Kuan
Hsien-Kuan 2024 年 11 月 14 日 3:45
コメント済み: Hsien-Kuan 2024 年 11 月 14 日 14:07
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')
  1 件のコメント
Hsien-Kuan
Hsien-Kuan 2024 年 11 月 14 日 3:54
移動済み: Star Strider 2024 年 11 月 14 日 4:06
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.

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2024 年 11 月 14 日 4:33
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))
  1 件のコメント
Hsien-Kuan
Hsien-Kuan 2024 年 11 月 14 日 14:07
Thank you, Walter Roberson. This traditional wind rose chart is very popular, and it would be great to have a nonlinear representation of counts (frequency, or normalized probability) displayed as rtick in a future MATLAB version.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSignal Processing についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by