when i set the axes_class=AxesZero,i can’t change the fontsize of the tick label,i try use some way:
- ax.set_xticklabels(xlabels, fontsize=27)
- plt.xticks(fontsize= )
- plt.setp(ax.get_xticklabels(), fontsize=)
but all don’t work,so can any know why,and how to fix it,i will very appreciate!
The objects in mpl_toolkits (e.g. mpl_toolkits.axisartist.axislines.AxesZero — Matplotlib 3.5.1 documentation) have a different core API than the rest of Matplotlib but because it inherent from the base Axes has some unused attributes and methods. There has been an on-going but very slow process of standardizing these classes / pulling the most useful features into the core library.
To get access to the actual axis objects that are draw you want to do
import matplotlib.pyplot as plt
from mpl_toolkits.axisartist import AxesZero
fig, ax = plt.subplots(subplot_kw=dict(axes_class=AxesZero))
xaxis = ax.axis["bottom"]
Which is an instance of mpl_toolkits.axisartist.axis_artist.AxisArtist — Matplotlib 3.5.1 documentation however on a quick skim of the docs I do not see how to change the font size of the tick labels. Hopefully this at least points you in the right direction!