from matplotlib import pyplot
import math
def setLabelExample():
fig = pyplot.figure()
x = [i for i in range(200)]
y = [xi**2 for xi in x]
ax = fig.add_subplot(1,1,1)
ax.plot(x, y)
ax.tick_params(axis='x', labelsize=30)
fig.suptitle('Matplotlib xticklabels Example')
pyplot.show()
if __name__ == '__main__':
setLabelExample()
Matplotlib将这些称为xtick标签。它们可以通过许多不同的方式进行更改,作为参数传入,或者遍历和编辑(就像这里发布的解决方案Matplotlib make tick labels font size smaller)。
我接着发布了一个更简洁的解决方案,因为前者效率很低。
相关问题 更多 >
编程相关推荐