MATLAB Answers

Polarplot axis label: how to edit the value?

6 ビュー (過去 30 日間)
BeeTiaw
BeeTiaw 2018 年 12 月 21 日
編集済み: dpb 2018 年 12 月 24 日
Expert,
Can anyone tell me how is it possible to change the radial axis label in polarplot function? I want the original label to be subtracted by certain value, e.g. 1.0
I just to manipulate the axis label, without changing the value of the data or result. Thus, the plot will essential remain the same, just the label is "manipulated".
Suppose I have the following data:
x = linspace(0,2*pi);
y = cos(x)+ sin(x);
polarplot(x,y)
The results of that function is
Now, what I want is to change the original axis label [0 0.5 1.0 1.5] into [-1 -0.5 0 0.5].
How can we do that?
This is what I expect
Picture2.jpg

採用された回答

dpb
dpb 2018 年 12 月 21 日
hPP=polarplot(x,y); % plot, save handle
hPA=hPP.Parent; % retrieve polar axes handle (parent of polar plot)
hPA.RTickLabel=hPA.RTick-1; % rewrite radius tick labels as desired
hPA.RColor='r'; % change color
  9 件のコメント
dpb
dpb 2018 年 12 月 22 日
What release of ML???
I've never seen the dot notation return a char array in such a use--is that really the exact code? That's bizzaro, if so.
I think you'd already cleared the first row elements before by the output shown because it's
>> whos Rlab
Name Size Bytes Class Attributes
Rlab 3x4 24 char
>>
and is already 3x4 instead of 4x4 elements as it would be if hadn't already eliminated the first element. I think you inadvertently must have done something else to have caused the conversion from cell array to char array.
I just reran the sample here and even after clearing the first label content in the cell array and rewriting, as expected if one retrieves the new 'RTickLabel' content, it's still a cell array of four elements.

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

その他の回答 (0 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by