python标签label字体⼤⼩_Matplotlib使刻度标签的字体变⼩以下代码仅⽤于说明⽬的,不⼀定进⾏优化。
import matplotlib.pyplot as plt
import numpy as np
def xticklabels_example():
fig = plt.figure()
x = np.arange(20)
y1 = np.cos(x)
y2 = (x**2)
y3 = (x**3)
yn = (y1,y2,y3)
COLORS = ('b','g','k')
matplotlib中subplot
for i,y in enumerate(yn):
ax = fig.add_subplot(len(yn),1,i+1)
ax.plot(x, y, ls='solid', color=COLORS[i])
if i != len(yn) - 1:
# all but last
ax.set_xticklabels( () )
else:
for tick in _major_ticks():
tick.label.set_fontsize(14)
# specify integer or one of preset strings, e.g.
#tick.label.set_fontsize('x-small')
tick.label.set_rotation('vertical')
fig.suptitle('Matplotlib xticklabels Example')
plt.show()
if __name__ == '__main__':
xticklabels_example()

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。