Inconsistent tick labels font with matplotlib subplots

丶灬走出姿态 提交于 2019-12-02 07:19:00

Changes to the rcParams should always be made as soon as possible and necessarily before the objects they affect are created.

Thus, putting the rc changes at the top, resolves the issue:

import matplotlib.pyplot as plt
plt.rc('text', usetex=True)
plt.rc('font', family='sans-serif')

fig, axes = plt.subplots(nrows=1, ncols=1)
x = [1,2,3,4,5]
plt.plot(x)

plt.show()
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!