Why is theta=0 not on top

9 ビュー (過去 30 日間)
Heidi Hirsh
Heidi Hirsh 2019 年 6 月 4 日
コメント済み: Walter Roberson 2019 年 6 月 5 日
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 Center および File ExchangePolar Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by