python绘图设置新罗马字体_更改matplotlib中的字体

本文探讨了在Python的matplotlib库中尝试设置图表标题为'Times New Roman'字体时遇到的问题。尝试了多种方法,包括修改字体配置,但遇到了警告和无法成功应用的情况。列出的代码片段展示了尝试的解决方案及其效果。
摘要由CSDN通过智能技术生成

所以我已经尝试了很多我能在stackoverflow上找到的东西(还有其他任何google会引导我的地方);我就是不能改变该死的字体!

以下是我迄今为止所做尝试的非详尽列表:import matplotlib.pyplot as plt

csfont = {'fontname':'Times New Roman'}

x = [1,2,3]

y = x

plt.plot(x,y)

plt.title('Please be Times >__

plt.show()

提供此错误日志:>>> (executing file "")

Note on using QApplication.exec_():

The GUI event loop is already running in the pyzo kernel, and exec_()

does not block. In most cases your app should run fine without the need

for modifications. For clarity, this is what the pyzo kernel does:

- Prevent deletion of objects in the local scope of functions leading to exec_()

- Prevent system exit right after the exec_() call

/home/antoine/miniconda3/lib/python3.6/site-packages/matplotlib/font_manager.py:1297: UserWarning: findfont:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值