Matplotlib - use Korean font
[Notice] [visualization_practice_first]
Matplotlib - use Korean font
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
DataFrame load
df = pd.read_csv('https://bit.ly/ds-house-price-clean')
df
지역 | 규모 | 연도 | 월 | 분양가 | |
---|---|---|---|---|---|
0 | 서울 | 60㎡이하 | 2015 | 10 | 5652 |
1 | 서울 | 60㎡초과 85㎡이하 | 2015 | 10 | 5882 |
2 | 서울 | 85㎡초과 102㎡이하 | 2015 | 10 | 5721 |
3 | 서울 | 102㎡초과 | 2015 | 10 | 5879 |
4 | 인천 | 60㎡이하 | 2015 | 10 | 3488 |
... | ... | ... | ... | ... | ... |
3288 | 경남 | 60㎡초과 85㎡이하 | 2020 | 2 | 3065 |
3289 | 경남 | 85㎡초과 102㎡이하 | 2020 | 2 | 3247 |
3290 | 제주 | 60㎡이하 | 2020 | 2 | 4039 |
3291 | 제주 | 60㎡초과 85㎡이하 | 2020 | 2 | 3962 |
3292 | 제주 | 102㎡초과 | 2020 | 2 | 3601 |
3293 rows × 5 columns
df.plot()
<AxesSubplot:>
/Users/skhu_cv_mac/miniforge3/envs/dylan/lib/python3.10/site-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 50672 (\N{HANGUL SYLLABLE YEON}) missing from current font. fig.canvas.print_figure(bytes_io, **kw) /Users/skhu_cv_mac/miniforge3/envs/dylan/lib/python3.10/site-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 46020 (\N{HANGUL SYLLABLE DO}) missing from current font. fig.canvas.print_figure(bytes_io, **kw) /Users/skhu_cv_mac/miniforge3/envs/dylan/lib/python3.10/site-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 50900 (\N{HANGUL SYLLABLE WEOL}) missing from current font. fig.canvas.print_figure(bytes_io, **kw) /Users/skhu_cv_mac/miniforge3/envs/dylan/lib/python3.10/site-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 48516 (\N{HANGUL SYLLABLE BUN}) missing from current font. fig.canvas.print_figure(bytes_io, **kw) /Users/skhu_cv_mac/miniforge3/envs/dylan/lib/python3.10/site-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 50577 (\N{HANGUL SYLLABLE YANG}) missing from current font. fig.canvas.print_figure(bytes_io, **kw) /Users/skhu_cv_mac/miniforge3/envs/dylan/lib/python3.10/site-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 44032 (\N{HANGUL SYLLABLE GA}) missing from current font. fig.canvas.print_figure(bytes_io, **kw)
How to solve this problem
!sudo apt-get install -y fronts-nanum
!sudo fc-cache -fv
!rm ~/.cache/matplotlib -rf
plt.rc('font', family = 'NanumBarunGothic')
df.plot()
Option that make bigger size
plt.rcParams["figure.figsize"] = (12, 9)
댓글남기기