Description
Documentation Link
Problem
If I want to set the tick label fontsize, I can do the following:
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.set_xticks((0,1,2,3), list('0123'), **{'fontsize': 20})
ax.set_xticks((0,1,2,3), **{'fontsize': 20})
doesn't work as correctly documented:
**kwargs
Text properties for the labels. These take effect only if you pass labels. In other cases, please use tick_params.
So far so good. But if I try ax.tick_params('x', **{'fontsize': 20})
as suggested for this case, I get a ValueError: keyword fontsize is not recognized
.
A workaround is
for label in ax.get_xticklabels():
label.set_fontsize(20)
or using pyplot: plt.xticks(**{'fontsize': 20})
Suggested improvement
The description of kwargs
should be changed to something like
Text properties for the labels. These take effect only if you pass labels. In other cases, please use tick_params for the parameters listed there. Other Text parameters can be changed by setting the Text properties of the ticklabels.