Non-linear Scale for Radius Axis in a Polarhistogram Plot

조회 수: 11 (최근 30일)
Hsien-Kuan
Hsien-Kuan 2024년 11월 14일
댓글: Hsien-Kuan 2024년 11월 14일
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일
이동: Star Strider 2024년 11월 14일
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일
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일
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 CenterFile Exchange에서 Signal Processing에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by