フィルターのクリア

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 Center および File ExchangePolar Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by