How to label the x axis of a polar plot?

133 ビュー (過去 30 日間)
katelyn sowden
katelyn sowden 2020 年 12 月 14 日
コメント済み: Cris LaPierre 2020 年 12 月 14 日
So far I've found a way to lable the radial axis, but one of my old tests asks me to lable the x-axis, and I can't figure out a way to do it. Is there a version of this for the x axis? I'm supposed to name it 't'. Any help is appriciated!
ax = polaraxes;
ax.RAxis.Label.String = 'r';

回答 (2 件)

Cris LaPierre
Cris LaPierre 2020 年 12 月 14 日
A polar plot does not have a x-axis. It is defined by R and Theta.
For labels, there is a title, subtitle, and legend.
You can see a full list of properties here.
  3 件のコメント
Cris LaPierre
Cris LaPierre 2020 年 12 月 14 日
Not with subtitle, though that is a property. Best is probably a text box, as the other answer shows.
Cris LaPierre
Cris LaPierre 2020 年 12 月 14 日
Actually, that's not entirely true. You could set the position property, though it's operating on the same principle as text.
polarplot([0 pi/2 pi],[1 2 3])
ax = gca;
d = ax.ThetaDir;
ax.ThetaDir = 'clockwise';
title('Clever Title');
subtitle('An Insightful Subtitle',"Position",[90,3.8],"HorizontalAlignment","center")

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


Kelly Kearney
Kelly Kearney 2020 年 12 月 14 日
You can label polar axes with text objects. I find the following positioning works well as a default... you may need to play around with coordinates, horizontal and vertical alignment, and rotation to find a combination that works best for you:
rmax = 2;
hax = polaraxes('RLim', [0 rmax]);
text(0, rmax/2, 'R Axis Label', 'horiz', 'center', 'vert', 'top', 'rotation', 0);
text(pi/4, rmax*1.2, 'Theta Axis Label', 'horiz', 'center', 'rotation', -45);

カテゴリ

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