MATLAB: Is theta=0 not on top

polar histogram theta direction

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)

Best Answer

After "Ax = gca;" in your code, please add the following two lines.
Ax.ThetaDir = 'clockwise';
Ax.ThetaZeroLocation = 'top';