Effacer les filtres
Effacer les filtres

Why is theta=0 not on top

13 vues (au cours des 30 derniers jours)
Heidi Hirsh
Heidi Hirsh le 4 Juin 2019
Commenté : Walter Roberson le 5 Juin 2019
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)

Réponse acceptée

Akira Agata
Akira Agata le 5 Juin 2019
After "Ax = gca;" in your code, please add the following two lines.
Ax.ThetaDir = 'clockwise';
Ax.ThetaZeroLocation = 'top';
  1 commentaire
Walter Roberson
Walter Roberson le 5 Juin 2019
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.

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by