2013年9月24日 星期二

[Matlab] 移除極座標內的格點線

http://www.mathworks.com/support/solutions/en/data/1-1BPZF/index.html?product=ML&solution=1-1BPZF


Subject:
How can I remove the grid lines and labels from a polar plot within MATLAB?

Problem Description:
I have created a plot with the POLAR function from which I want to remove the grid lines and labels. However, changing the axes' properties does not affect the polar plot.

Solution:
There are no actual polar axes in MATLAB 6.5.1 (R13SP1) and earlier versions. The polar plot is created with a patch object representing the background, and multiple line and text objects used to create the grid lines and labels, respectively. These objects exist in an axes, whose "Visible" property has been set to "off".

You can remove the labels and grid lines from a polar plot by locating their handles with the FINDALL function, and using the DELETE function to remove them.


% create the polar plot, and store the line's handle
p = polar((0:99)*pi/100, (0:99)/100);

% find all of the lines in the polar plot
h = findall(gcf,'type','line');

% remove the handle for the polar plot line from the array
h(h == p) = [];

% delete all other lines
delete(h);

% find all of the text objects in the polar plot
t = findall(gcf,'type','text');

% delete the text objects
delete(t);

沒有留言:

張貼留言