How do I rotate or flip a polar plot?
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
I would like to change the orientation of a polar plot from the default (0 degrees on the right, counterclockwise for increasing angles).
採用された回答
MathWorks Support Team
2020 年 10 月 12 日
編集済み: MathWorks Support Team
2020 年 12 月 8 日
Depending on what function you are using to generate your polar plot, there are different ways to achieve this.
1. If you are using the more recent "polarplot" function:
You can set the theta orientation to certain default values by using the "ThetaZeroLocation" property of the polaraxes object: https://www.mathworks.com/help/matlab/ref/matlab.graphics.axis.polaraxes-properties.html#bu8f1sf_sep_shared-ThetaZeroLocation
This property accepts values of "right", "top", "left", and "bottom".
Additionally, you can simulate setting the "ThetaZeroLocation" to an arbitrary value by changing the "ThetaData" property of the polaraxes' children objects to achieve the desired rotation. (See the attached M file for an example of how to achieve this using a uislider within a UIFigure). Some important things to note when using this approach:
- If there are any plotted objects whose angular positions are not controlled by the "ThetaData" property (ie, text objects), you will need to adapt their positional properties to be consistent with the polaraxes' coordinates.
- Changing the "ThetaData" values for the children objects means that they no longer retain their original values. For example, if the original theta value was 0 and we have rotated it 15 deg, then its new theta value will be 15. To work around this, it is recommended to store the current orientation of the polar axes relative to the "ThetaZeroLocation". This will allow you to get the original data values back
2. If you are using the older "
polar
" function:
The orientation of a plot can be set using the "view" command. For example,
t = 0:0.01:2*pi;
polar(t,sin(2*t).*cos(2*t))
view([180 90])
creates a polar plot with 0 degrees on the left and increasing angles in the counterclockwise direction. Executing the command\nchanges the view so that 0 degrees on is at the top of the figure and increasing angles are in the clockwise direction.
view([90 -90])
6 件のコメント
Sudarshan Kolar
2016 年 11 月 17 日
Please refer to the following documentation link: https://www.mathworks.com/help/matlab/ref/polaraxes-properties.html
ThetaZeroLocation and ThetaDir should be useful.
Steven Lord
2019 年 2 月 7 日
If you're using a release that has the polaraxes function, use that instead of trying to manipulate the view of the axes. First make some sample data.
t = 0 : .01 : 2*pi;
Create a polaraxes.
ax = polaraxes;
Plot a curve on it.
polarplot(ax, t, t.*sin(2*t), '--r');
Change where the theta = 0 line is located and the direction in which theta increases.
ax.ThetaDir = 'clockwise';
ax.ThetaZeroLocation = 'top';
Steven Lord
2019 年 12 月 12 日
The ThetaZeroLocation property of polaraxes only allows you to set the zero location to 'top', 'bottom', 'left', and 'right'. So as far as I'm aware there isn't an easy way to do what you're asking. You could try simulating it by modifying the ThetaTick and ThetaTickLabel properties.
If you have an application where you need the theta zero location to be at an arbitrary angle, consider sending it to Technical Support with an enhancement request to generalize the values the ThetaZeroLocation property can take.
Adam Danz
2020 年 9 月 28 日
Here's an answer that shows the general approach to adjusting the orientation of polaraxes to an arbitrary angle other than 'right' | 'top' | 'left' | 'bottom'.

Adam Danz
2021 年 7 月 1 日
The only two ways I'm aware of is by setting orientation using one of the options in my answer or by using the approach outlined in another answer I provided a link to.
Steven Lord
2021 年 7 月 1 日
ax = polaraxes;
polarplot(ax, 1:10)
ax.ThetaZeroLocation = 'top';

Do you want the theta direction to be counter-clockwise or do you want 90 degrees to be at the right? You can't have both. If the latter run the last command in the code below (I'm repeating the plot commands so MATLAB Answers will show both polar plots.)
figure
ax = polaraxes;
polarplot(ax, 1:10)
ax.ThetaZeroLocation = 'top';
ax.ThetaDir = 'clockwise'; % 90 degrees at the right

その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Polar Plots についてさらに検索
製品
タグ
タグが未入力です。
参考
2009 年 7 月 6 日
2021 年 7 月 1 日
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
