필터 지우기
필터 지우기

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

조회 수: 114 (최근 30일)
Helen
Helen 2021년 6월 25일
댓글: Star Strider 2021년 6월 25일
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?

답변 (2개)

Star Strider
Star Strider 2021년 6월 25일
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
Helen
Helen 2021년 6월 25일
I'm using 2017b, but ThetaZeroLocation does not exist as a polarscatter property.
Star Strider
Star Strider 2021년 6월 25일
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.
.

댓글을 달려면 로그인하십시오.


Chunru
Chunru 2021년 6월 25일
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
Helen
Helen 2021년 6월 25일
Thank you. I was hoping that there was a way to do it that didn't involve manually fiddling with everything!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Polar Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by