How can I rotate the axis for a polar plot?

33 ビュー (過去 30 日間)
dhhtr
dhhtr 2015 年 4 月 7 日
コメント済み: Toshia M 2025 年 7 月 9 日
Hi,
Would anyone know how to adjust (rotate) the polar plot function such that the vertical axis starts at 0 degrees - as opposed to 90?
theta=0:0.1:2*pi;
e=cos(theta);
polar(theta,e);
Kind regards,

採用された回答

Geoff Hayes
Geoff Hayes 2015 年 4 月 7 日
See the answer at http://www.mathworks.com/matlabcentral/answers/93690-how-do-i-rotate-or-flip-a-polar-plot which changes the viewpoint specification using view. For your case, you would want to call (after the polar plot has been created)
view([90 -90])
  2 件のコメント
dhhtr
dhhtr 2015 年 4 月 8 日
Thanks, Geoff.
Toshia M
Toshia M 2025 年 7 月 9 日
Starting in R2016a, you can create a PolarAxes object that has properties you can customize. To rotate a PolarAxes object, set the ThetaZeroLocation property. By default, the zero angle is located to the right of the origin.
The ThetaZeroLocation property accepts four string values ("top", "bottom", "left", or "right"). Starting in R2025a, you can specify this property as an arbitrary angle.
For example, create a polar plot and set the ThetaZeroLocation property to pi/4 radians.
(The default theta axis units is degrees, so if you specify an angle in radians, you need to set the ThetaAxisUnits to "radians".)
pax = polaraxes;
theta = linspace(0,6*pi);
rho = theta/10;
polarplot(pax,theta,rho)
% Specify radians for theta axis
pax.ThetaAxisUnits = "radians";
% Rotate by pi/4 radians
pax.ThetaZeroLocation = pi/4;
See the polaraxes documentation for more information.

サインインしてコメントする。

その他の回答 (1 件)

Steve Snarski
Steve Snarski 2019 年 9 月 25 日
Use axes properties. To rotate theta = 0 from right side [default] to bottom use following:
set(gca,'ThetaZeroLocation','bottom')
  1 件のコメント
mahmoud deghedy
mahmoud deghedy 2020 年 12 月 23 日
U R a Legend

サインインしてコメントする。

カテゴリ

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