python绘图设置新罗马字体_更改matplotlib中的字体
所以我已經(jīng)嘗試了很多我能在stackoverflow上找到的東西(還有其他任何google會(huì)引導(dǎo)我的地方);我就是不能改變?cè)撍赖淖煮w!
以下是我迄今為止所做嘗試的非詳盡列表: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()
提供此錯(cuò)誤日志:>>> (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: Font family ['Times New Roman'] not found. Falling back to DejaVu Sans
(prop.get_family(), self.defaultFamily[fontext]))
>>>import matplotlib.pyplot as plt
plt.rcParams["font.family"] = "Times New Roman"
x = [1,2,3]
y = x
plt.plot(x,y)
plt.title('Please be Times >__
plt.show()
沒(méi)有顯示錯(cuò)誤;但這不是時(shí)間。。。
對(duì)我來(lái)說(shuō),第一次嘗試給出錯(cuò)誤日志也有點(diǎn)困難,因?yàn)樽鰐his answer建議的事情表明,Times New Roman確實(shí)是一種我應(yīng)該能夠使用的字體:>>> set([f.name for f in matplotlib.font_manager.fontManager.afmlist])
{'Courier', 'Times', 'URW Bookman L', 'Nimbus Mono L', 'ITC Bookman', 'ZapfDingbats', 'Century Schoolbook L', 'New Century Schoolbook', 'Helvetica', 'Standard Symbols L', 'Utopia', 'Palatino', 'URW Gothic L', 'Courier 10 Pitch', 'Symbol', 'Computer Modern', 'Bitstream Charter', 'ITC Avant Garde Gothic', 'Nimbus Roman No9 L', 'ITC Zapf Chancery', 'ITC Zapf Dingbats', 'URW Chancery L', 'Nimbus Sans L', 'Dingbats', 'URW Palladio L'}
所以。。。我還能試什么?
總結(jié)
以上是生活随笔為你收集整理的python绘图设置新罗马字体_更改matplotlib中的字体的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 在Visual Studio中对Epic
- 下一篇: UEFI——PCD研究