I want to change the color of the rticklabels in a polar plot to white. It works with
ax.set_rgrids([1., 2., 3.], color='white')
However, using set_rgrids
I have to give the positions of the ticklabels. I would rather like to use the standard positions, such that I don't have to think about their values for different data sets.
I there a way to directly access and change the color of the rticklabels?
There is a way: for a polar plot, theta
and r
map onto x
and y
respectively for the generic axis actions. So - you just do
rlabels = ax.get_ymajorticklabels()
for label in rlabels:
label.set_color('white')
Documentation for get_ymajorticklabels()
shows that it returns a list of Text
objects - the actions you can perform on a Text
object are in the docs.