Effacer les filtres
Effacer les filtres

How can I re-orient a polar scatter plot so zero is at the top?

114 vues (au cours des 30 derniers jours)
Helen
Helen le 25 Juin 2021
Commenté : Star Strider le 25 Juin 2021
The default orientation for a polarscatter plot is with the zero to the right hand side and 90 degrees at the top. I have geographical data (so zero degrees is north) and so I want the zero to be at the top and the numbers to increase clockwise. I've looked in all the axis properties but I can't see any way of doing this. I need to use a scatter plot because I want to colour code the markers. Is it possible to re-orient it?

Réponses (2)

Star Strider
Star Strider le 25 Juin 2021
Use polaraxes properties to do this —
th = rand(1,10)*2*pi; % Angles
r = rand(size(th)); % Radii
figure
polarscatter(th, r, 75, 'filled')
title('Original')
figure
hps = polaraxes; % First, Declare A 'polaraxes' Object & Return Its Handle
polarscatter(th, r, 75, 'filled'); % Then Use 'polarscatter'
hps.ThetaZeroLocation = 'top'; % Change Angle Origin
hps.ThetaDir = 'clockwise'; % Change Angle Direction
title('Desired Result')
I am not certain when these properties were introduced. This works in R2021a.
.
  5 commentaires
Helen
Helen le 25 Juin 2021
I'm using 2017b, but ThetaZeroLocation does not exist as a polarscatter property.
Star Strider
Star Strider le 25 Juin 2021
The ThetaZeroLocation property is not a polarscatter property. It is a polaraxes property. That is the reason I declared polaraxes first, then plotted onto it with polarscatter.
.

Connectez-vous pour commenter.


Chunru
Chunru le 25 Juin 2021
th = linspace(0,2*pi,20);
r = rand(1,20);
sz = 75;
figure;
subplot(121)
polarscatter(th,r,sz,'filled')
subplot(122)
h = polarscatter(pi/2-th,r,sz,'filled'); % North, Clockwise
thetaTick = h.Parent.ThetaTick;
h.Parent.ThetaTickLabel = string(wrapTo360( 90-thetaTick));
  1 commentaire
Helen
Helen le 25 Juin 2021
Thank you. I was hoping that there was a way to do it that didn't involve manually fiddling with everything!

Connectez-vous pour commenter.

Catégories

En savoir plus sur Polar Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by