matplotlib는 기본 글꼴이 영문 글꼴이다. 따라서 그래프에 한글을 표기하려고 하면 경고(warning)가 뜨고, 한글이 ▯으로 표시된다! 아래와 같이 rc 함수를 이용해 글꼴 설정을 바꾸어 문제를 해결할 수 있다.
import matplotlib.pyplot as plt
if os.name == 'posix':
plt.rc("font", family="AppleGothic")
else:
plt.rc("font", family="Malgun Gothic")