Spacey
Spacey

Reputation: 3017

Change color of polar plot ticks/radial lines in MATLAB?

I am surprisingly not able to ascertain how exactly I change the color of the ticks and/or the radial lines of a polar plot, see figure below:

enter image description here

Quite simply, I want to change the color of the radial dotted lines you see here, to say, blue or something. I would also like to change the color of the numbers and the edge you see here to say, red. How is this possible?

Upvotes: 1

Views: 4219

Answers (1)

Mikhail
Mikhail

Reputation: 76

In this link http://www.mathworks.com/matlabcentral/answers/67 they show how to delete every grid line in a polar plot.

I think you can try something similar, but instead to delete you'll only change the color.

I achieved the result with the code below:

p = polar(1);   % plot a circle with radius = 1;
h = findall(gcf, 'type', 'line'); % find all lines in the current figure
h(h==p) = []; % remove the line you ploted from the list.
set(h, 'Color', 'g'); % make all of them green
T = findall(gcf, 'type', 'text'); % find all text
set(T, 'Color', 'r'); % change its color

Notice that it changes the color of every line that is not the one you ploted (in the example only the circle with r=1 remains unchanged). If you need to change only the grid you'll need to refine the search made by the function "findall". See "doc findall" for more info on it.

Upvotes: 4

Related Questions