如何从Matlab极坐标图中删除Rho标签?

问题描述:

在Matlab的极坐标图中,我有Theta(0,30,60,..,330)和Rho(20,40,..,100)的默认标签. 我可以使用命令

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', ' ');

请建议如何从图中移除Rho标签(20、40,..,100).

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

要删除所有标签,只需键入

To remove all labels simply type

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

由于极坐标图标签是放置在图上的隐藏文本对象,因此您不能简单地通过访问轴来找到它们.要仅删除其中一些,您将需要显式地找到包含要删除的特定标签的文本对象.在您的情况下,查找包含Rho的文本对象:

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