Why is theta=0 not on top
13 views (last 30 days)
Show older comments
Heidi Hirsh
on 4 Jun 2019
Commented: Walter Roberson
on 5 Jun 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)
0 Comments
Accepted Answer
Akira Agata
on 5 Jun 2019
After "Ax = gca;" in your code, please add the following two lines.
Ax.ThetaDir = 'clockwise';
Ax.ThetaZeroLocation = 'top';
1 Comment
Walter Roberson
on 5 Jun 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.
More Answers (0)
See Also
Categories
Find more on Polar Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!