日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

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

發布時間:2023/12/16 python 42 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python绘图设置新罗马字体_更改matplotlib中的字体 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

所以我已經嘗試了很多我能在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: 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()

沒有顯示錯誤;但這不是時間。。。

對我來說,第一次嘗試給出錯誤日志也有點困難,因為做this answer建議的事情表明,Times New Roman確實是一種我應該能夠使用的字體:>>> 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'}

所以。。。我還能試什么?

總結

以上是生活随笔為你收集整理的python绘图设置新罗马字体_更改matplotlib中的字体的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。