Changing the radial axislabels in a polar plot
1 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
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
0 个评论
更多回答(1 个)
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
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Axis Labels 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!