How to remove Rho labels from Matlab polar plot?

我怕爱的太早我们不能终老 提交于 2019-12-01 12:45:02

问题


In my polar plot in Matlab, I have default labels for Theta (0, 30, 60, .., 330) and Rho (20, 40, .., 100). I can remove Theta label using command

set(findall(gca, 'String', '0'),'String', ' ');

Please advice how to remove Rho labels (20, 40, .., 100) from the figure.


回答1:


To remove all labels simply type

delete(findall(gcf,'type','text'));

Since the polar plot labels are hidden text objects placed around on the plot, you can not simply find them by accessing axes. To remove only some of them you will need to explicitly find the text objects containing those particular labels you want to delete. In your case, look for text objects containing Rho:

% Get all strings in the hidden labels, choose the ones you want to delete
% Note that some of the labels may contain spaces - you need to be exact.
get(findall(gcf, 'type', 'text'), 'string');

% say your labels have the following strings..
rho_labels = {'20' '40' '60' '80' '100'};
for r=1:length(rho_labels)
    delete(findall(gcf, 'string', rho_labels{r}))
end


来源:https://stackoverflow.com/questions/12581008/how-to-remove-rho-labels-from-matlab-polar-plot

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!