matplotlibé€度€度。
#python #matplotlib

matplotlib是Åäçãoä®

>>> import matplotlib.pyplot as plt
>>> plt.pie(
... [800, 300, 400],
... labels=['交通', '娛樂', '教育'])
([<matplotlib.patches.Wedge object at 0x000001CB83DFC250>, <matplotlib.patches.Wedge object at 0x000001CB83DFC700>, <matplotlib.patches.Wedge object at 0x000001CB83DFCB80>], [Text(-0.11498140519131439, 1.093974074857458, '交通'), Text(-0.7360435164738056, -0.8174594435547703, '娛樂'), Text(0.7360438608860855, -0.817459133444544, '教育')])
ét的¾èâxththeIÅCjk的行为,请参见IÅCJK¶Å

>>> plt.show()
D:\Program Files\Python310\lib\tkinter\__init__.py:839: UserWarning: Glyph 20132 (\N{CJK UNIFIED IDEOGRAPH-4EA4}) missing from current font.func(*args)
D:\Program Files\Python310\lib\tkinter\__init__.py:839: UserWarning: Glyph 36890 (\N{CJK UNIFIED IDEOGRAPH-901A}) missing from current font.func(*args)
D:\Program Files\Python310\lib\tkinter\__init__.py:839: UserWarning: Glyph 23067 (\N{CJK UNIFIED IDEOGRAPH-5A1B}) missing from current font.func(*args)
D:\Program Files\Python310\lib\tkinter\__init__.py:839: UserWarning: Glyph 27138 (\N{CJK UNIFIED IDEOGRAPH-6A02}) missing from current font.func(*args)
D:\Program Files\Python310\lib\tkinter\__init__.py:839: UserWarning: Glyph 25945 (\N{CJK UNIFIED IDEOGRAPH-6559}) missing from current font.func(*args)
D:\Program Files\Python310\lib\tkinter\__init__.py:839: UserWarning: Glyph 32946 (\N{CJK UNIFIED IDEOGRAPH-80B2}) missing from current font.func(*args)

Å。

è吗

äst€¶ÅɪstRIT â€Å -μμμμÁÅ了æææ付给了ææ付给了ææ付给了ææ付给

>>> from matplotlib.font_manager import fontManager
>>> for i in sorted(fontManager.get_font_names()):
...     print(i)
Agency FB
Algerian
...
Microsoft JhengHei
Microsoft New Tai Lue
Microsoft PhagsPa
Microsoft Sans Serif
Microsoft Tai Le
Microsoft YaHei
Microsoft Yi Baiti
MingLiU
MingLiU-ExtB
...
<>Ū丁。

>>> import matplotlib
>>> matplotlib.rc('font', family='Microsoft JhengHei')

飣£Žäå±±±±±±±±±±±±±±#toct¾#t _ #t _#

>>> plt.pie(
... [800, 300, 400],
... labels=['交通', '娛樂', '教育'])
([<matplotlib.patches.Wedge object at 0x000001CB87E615D0>, <matplotlib.patches.Wedge object at 0x000001CB833A72E0>, <matplotlib.patches.Wedge object at 0x000001CB87E63310>], [Text(-0.11498140519131439, 1.093974074857458, '交通'), Text(-0.7360435164738056, -0.8174594435547703, '娛樂'), Text(0.7360438608860855, -0.817459133444544, '教育')])

>>> plt.show()

±±±±±±Åäâ€

�®rcparams究¶

ÅåÅ。 件,ä½ä½Å了»¥ç¥¥¥ä。®®完成,ä /μ

>>> matplotlib.rcParams['font.family'] = 'MingLiU'
>>> plt.pie(
... [800, 300, 400],
... labels=['交通', '娛樂', '教育'])
([<matplotlib.patches.Wedge object at 0x0000021F3E56BC40>, <matplotlib.patches.Wedge object at 0x0000021F3EE44910>, <matplotlib.patches.Wedge object at 0x0000021F3E569BD0>], [Text(-0.11498140519131439, 1.093974074857458, '交通'), Text(-0.7360435164738056, -0.8174594435547703, '娛樂'), Text(0.7360438608860855, -0.817459133444544, '教育')])

>>> plt.show()

±±±±±¹S.

ä½ç - rcŽÅ11ç½SaææÆæthe“ i”,3/4¾Å€¥¥et forto- forto - «è®Å§§§§±¯

>>> matplotlib.rc('font',
...     family='Microsoft JhengHei',
...     size=32
... )
>>> plt.pie(
... [800, 300, 400],
... labels=['交通', '娛樂', '教育'])
([<matplotlib.patches.Wedge object at 0x0000021F3E51D000>, <matplotlib.patches.Wedge object at 0x0000021F3E51EE60>, <matplotlib.patches.Wedge object at 0x0000021F3E51EAD0>], [Text(-0.11498140519131439, 1.093974074857458, '交通'), Text(-0.7360435164738056, -0.8174594435547703, '娛樂'), Text(0.7360438608860855, -0.817459133444544, '教育')])

>>> plt.show()

v ®

ÉÅ?äst â€ÅÅç©ä»¶,ç±ä»¥ästR

>>> matplotlib.rcParams is matplotlib.pyplot.rcParams
True

i Act££ª¯讯

matplotlibrcèÅ®æª

婴儿正在吃asp虫,是®是®,是event的epic; ±±±Å¼¾ï¼Åª

>>> matplotlib.matplotlib_fname()
'D:\\code\\pytest\\lib\\site-packages\\matplotlib\\mpl-data\\matplotlibrc'

ÉPHIAMIAMIAMIAMIAMIAMIAMIAMIAMIAMIAMIAMIMMAGROTLIBÅ®£æÆæææ¾他是eperature的 - 和Is ost¢rest棒“”â·Å½Å½¶¶¶¶¶ilick¶¶¶¶il

¾,¾,

>>> import matplotlib
>>> matplotlib.rcParams['font.family']
['Microsoft JhengHei']

Å在Windows£½ä½ä½ä½;½的½Å½Å½Å /® ªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªª -Cesive。

ææ *nixC。

ç - Å。

matprotlibææ¯ °® - Serifãserifãserifãserifãsurifãsurifãserifãsmonppaceais5ÅI®®ISTISRON,eædédiboutiald; Å®Å| oute | out

>>> matplotlib.rc('font',
...     family='serif',
...     serif=['ABC', 'MingLiU'],
...     size=32
... )

是£€和eriféiousOOUSÅPOUTOOOOKK了â€Å的ÅTOOPOUT (Å)1个活动tÅ -zzoÅä亮了字体。 ££¢EnglishÅééc±所有±所有±iLæææć±±±±±±ÅÅ和Å是ÅEvì(eu。eu。eu。

ét æɪqQåQåQåQåQå()ÅVOA()ÅVOATHUÅHUAHUO°¥极±±±±±±±ÅäÅšandæ}qä} ÅÅÅÅÅ奥播放和ÉearchTient

Å基æ€ÅK了żμÅ了S。 »¥ÅÅMatplotlibæmatplotlib.pyplotæ�çµÉFrc_context() 函式,ÅFAIN

>>> plt.rc('font', family='MingLiu')
>>> with plt.rc_context(rc= {'font.family': 'Microsoft JhengHei'}):
...     plt.title("圓餅圖")
>>> plt.pie(
... [800, 300, 400],
... labels=['交通', '娛樂', '教育'])
([<matplotlib.patches.Wedge object at 0x0000025D64A0AA10>, <matplotlib.patches.Wedge object at 0x0000025D64A217E0>, <matplotlib.patches.Wedge object at 0x0000025D64A234F0>], [Text(-0.11498140519131439, 1.093974074857458, '交通'), Text(-0.7360435164738056, -0.8174594435547703, '娛樂'), Text(0.7360438608860855, -0.817459133444544, '教育')])

>>> plt.show()

ä½Å了»娃娃érc_context()è带ÅÅ,€ Å,带有Çµμ ˆÅÅÅ°±è®æ®

Å¥isÅF。

ÆƱä½èæèmindimpaç。 ±±±±±±±±±±±±±±±£££££££££££££££££££€â€¾¾»讯» addFont()æ劫可¢Å

>>> plt.pie(
... [800, 300, 400],
... labels=['교통', '오락', '기르다'])

ű±±±±±ÉrnationalÉrolthitationÉritIt lick evu错误讯走

Å -c d'ebfont()Æâ±±±±±±±±± Å`

>>> fontManager.addfont('D:\\temp\\NotoSerifKR-Regular.otf')
>>> for i in sorted(fontManager.get_font_names()):
...     print(i)
Agency FB
...
Noto Serif CJK TC
Noto Serif KR
Noto Serif TC
...

ÅFoup

>>> matplotlib.rc('font', family='Noto Serif KR')
>>> plt.pie(
... [800, 300, 400],
... labels=['교통', '오락', '기르다'])
([<matplotlib.patches.Wedge object at 0x000001CB88634340>, <matplotlib.patches.Wedge object at 0x000001CB88636050>, <matplotlib.patches.Wedge object at 0x000001CB88635750>], [Text(-0.11498140519131439, 1.093974074857458, '교통'), Text(-0.7360435164738056, -0.8174594435547703, '오락'), Text(0.7360438608860855, -0.817459133444544, '기르다')])

>>> plt.show()

±±±±Åäɪ后者ÅbRISTRINCE。

çμ

ppopplatlibçzi discernâc t – eerù是法国的。今天。 ÆÆÆ