Non-linear Scale for Radius Axis in a Polarhistogram Plot

57 visualizaciones (últimos 30 días)
Hsien-Kuan
Hsien-Kuan el 14 de Nov. de 2024 a las 3:45
Comentada: Hsien-Kuan el 14 de Nov. de 2024 a las 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 comentario
Hsien-Kuan
Hsien-Kuan el 14 de Nov. de 2024 a las 3:54
Movida: Star Strider el 14 de Nov. de 2024 a las 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.

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
Walter Roberson el 14 de Nov. de 2024 a las 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 comentario
Hsien-Kuan
Hsien-Kuan el 14 de Nov. de 2024 a las 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.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Signal Processing en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by