フィルターのクリア

Changing the radial axislabels in a polar plot

2 ビュー (過去 30 日間)
Jakob Sievers
Jakob Sievers 2011 年 11 月 8 日
回答済み: Ramez hamid 2014 年 11 月 27 日
Hi guys
Plenty of questions have been asked here regarding changing the axislabels in a polarplot. They have, as far as I can see, all focused on the circumferential axislabels (i.e.: for instance changing 0,90,180,etc. to N,E,S,etc.).
I am however trying to change the radial labels and I cant seem to find any previously mentioned solutions which do the trick ( This is an example i tried following but with no success.). I'm plotting values that lie between 0 and 2, thus resulting in the labels: 0.5, 1.0, 1.5 and 2.0. How can I change these?
Thanks in advance

採用された回答

Jonathan
Jonathan 2011 年 11 月 8 日
Jakob,
This is a necessarily, I think, imprecise process. That is, this method may become invalid with later distributions of Matlab. I have found that the labels in your particular situation start with two spaces. This is a quite volatile piece of information to use, but it gets the job done. Here is my code to setup the labels.
% Get figure and axes
fHand = figure;
aHand = axes('parent', fHand);
% Make sure limits are correct.
pHand = polar(0, 2, 'parent', aHand);
delete(pHand)
% Get the handles of interest (using volatile info above).
hands = findall(fHand,'parent', aHand, 'Type', 'text');
hands = hands(strncmp(' ', get(hands,'String'), 2));
hands = sort(hands);
% Relabel from inside out.
labels = {'label one', 'label two', 'label three', 'label four'}
for i = 1:4
set(hands(i),'String', labels{i})
end
% Make sure to 'hold on' to keep your labels before plotting.
hold on
t = 0:.01:2*pi; polar(t,4*sin(2*t).*cos(2*t),'--r', 'parent', aHand);
I hope this helps.
~Jonathan

その他の回答 (1 件)

Ramez hamid
Ramez hamid 2014 年 11 月 27 日
Hello folks
Please I would like to know how can I change the positions of the Rho labels in a polar plot?
Many thanks

カテゴリ

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