Why is theta=0 not on top

14 次查看(过去 30 天)
I am tryin to plot polar histograms of currents. For some reason 90 degrees is plotting on top. Even thought I define the direction as clockwise and zero on top. Does anyone know why this is happening?
%% June 12-17
clear t1; clear t2; clear k1; clear k2;
t1=datenum(2018,06,12,00,00,00);
t2=datenum(2018,08,07,00,00,00);
k1 = find(abs(t1-time) == min(abs(t1-time)));
k2 = find(abs(t2-time) == min(abs(t2-time)));
f1=figure(1)
clear wind_direction; clear wind_speed
direction = PKdir(k1:k2);
speed = PKmag(k1:k2);
% direction = PKdir;
% speed = PKmag;
polarhistogram(deg2rad(direction(speed<.28)),deg2rad(0:10:360),'FaceColor','r','displayname','.12-.28 m/s','Normalization','probability')
hold on
polarhistogram(deg2rad(direction(speed<.12)),deg2rad(0:10:360),'FaceColor','y','displayname','.09-.12 m/s','Normalization','probability')
polarhistogram(deg2rad(direction(speed<.09)),deg2rad(0:10:360),'FaceColor','g','displayname','.06-.09 m/s','Normalization','probability')
polarhistogram(deg2rad(direction(speed<.06)),deg2rad(0:10:360),'FaceColor','b','displayname','.03-.06 m/s','Normalization','probability')
polarhistogram(deg2rad(direction(speed<.03)),deg2rad(0:10:360),'FaceColor','m','displayname','0-.03 m/s','Normalization','probability')
pax.ThetaDir = 'clockwise';
pax.ThetaZeroLocation = 'top';
Ax = gca;
RT = Ax.RTick;
Ax.RTickLabel = compose('%2d%%', RT*100);
legend('Show','fontsize',16)
title('PK: June 12 - June 17','fontsize',16)

采纳的回答

Akira Agata
Akira Agata 2019-6-5
After "Ax = gca;" in your code, please add the following two lines.
Ax.ThetaDir = 'clockwise';
Ax.ThetaZeroLocation = 'top';
  1 个评论
Walter Roberson
Walter Roberson 2019-6-5
pax is not defined in the code, so it might not have any relationship to the current axes. It might not be defined at all, in which case pax.ThetaDir = 'clockwise' might simply be a structure assignment.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Polar Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by