Matplotlib: 두 판 사이의 차이

IT위키
편집 요약 없음
편집 요약 없음
9번째 줄: 9번째 줄:
* 기본적으로 한글 사용이 안된다. 한글 사용을 위핸 폰트를 지정해줘야 한다.
* 기본적으로 한글 사용이 안된다. 한글 사용을 위핸 폰트를 지정해줘야 한다.
<syntaxhighlight lang="python" line='line'>
<syntaxhighlight lang="python" line='line'>
from matplotlib import font_manager, rc
import matplotlib
import matplotlib.pyplot as pyplot
font_location = 'c:/Windows/fonts/malgun.ttf'
font_location = 'c:/Windows/fonts/malgun.ttf'
font_name = font_manager.FontProperties(fname=font_location).get_name()
font_name = font_manager.FontProperties(fname=font_location).get_name()
matplotlib.rc('font', family=font_name)  
matplotlib.rc('font', family=font_name)
 
pyplot.plot([1,2,3,4])
pyplot.xlabel('한글라벨')
pyplot.show()  
</syntaxhighlight>
</syntaxhighlight>



2018년 9월 15일 (토) 11:59 판

개요

Python에서 그래프를 그릴 수 있는 라이브러리

특징

  • 표준 플롯을 쉽게 그릴 수 있을 뿐만 아니라 복잡한 플롯과 세부적인 변경도 자유로운 유연한 라이브러리
  • Numpy 및 Pandas(Series, DataFrame)가 제공하는 자료들과도 잘 연동됨

Trouble Shooting

  • 기본적으로 한글 사용이 안된다. 한글 사용을 위핸 폰트를 지정해줘야 한다.
from matplotlib import font_manager, rc
import matplotlib
import matplotlib.pyplot as pyplot

font_location = 'c:/Windows/fonts/malgun.ttf'
font_name = font_manager.FontProperties(fname=font_location).get_name()
matplotlib.rc('font', family=font_name)

pyplot.plot([1,2,3,4])
pyplot.xlabel('한글라벨')
pyplot.show()

링크