Last active
November 20, 2021 08:08
-
-
Save geminixiang/b76f403a94e148746e28ac26598da515 to your computer and use it in GitHub Desktop.
Colab 中 matplotlib 顯示中文問題[快速解決]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 下載台北黑體 | |
!wget -O TaipeiSansTCBeta-Regular.ttf https://drive.google.com/uc?id=1eGAsTN1HBpJAkeVM57_C7ccp7hbgSz3_&export=download | |
import matplotlib as mpl | |
from matplotlib.font_manager import fontManager | |
# 修改字體設定 | |
fontManager.addfont('TaipeiSansTCBeta-Regular.ttf') | |
mpl.rc('font', family='Taipei Sans TC Beta') | |
# 簡單測試 | |
import matplotlib.pyplot as plt | |
plt.plot((10,20,30),(400,500,600)) | |
plt.title("標題") | |
plt.ylabel("y軸") | |
plt.xlabel("x軸") | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
更多請關注蔡炎龍老師的jupyter notebook
https://nbviewer.org/github/yenlung/Deep-Learning-Basics/blob/master/colab99_%E5%9C%A8_matplotlib_%E4%B8%AD%E4%BD%BF%E7%94%A8%E4%B8%AD%E6%96%87.ipynb?fbclid=IwAR0qEzwT_62unuwy2aAs5-E5HOVsFus8OZY_b4E0BIjDqPS4vcnEutEMpok