"분류:Matplotlib"의 두 판 사이의 차이
둘러보기로 가기
검색하러 가기
(새 문서: == 개요 == === 설치 === pip install matplotlib 분류:라이브러리) |
(→개요) |
||
(같은 사용자의 중간 판 하나는 보이지 않습니다) | |||
4번째 줄: | 4번째 줄: | ||
pip install matplotlib | pip install matplotlib | ||
+ | = 각종 팁 = | ||
+ | {| class="wikitable" | ||
+ | !의도 | ||
+ | !설명 | ||
+ | !방법 | ||
+ | |- | ||
+ | |폰트 추가 | ||
+ | |기본적으로 한글폰트가 없어 한글이 표시되지 않곤 한다. | ||
+ | 리눅스의 경우, 설치되어 있는데 반영이 안되는 경우도 있다. | ||
+ | | | ||
+ | # <code>fc-list</code>를 통해 폰트의 종류와 경로 파악. | ||
+ | # <code>python -c "import matplotlib; print(matplotlib.__file__)"</code>를 통해 matplotlib의 경로를 알아낸 후 | ||
+ | # 사용할 폰트를 복사한다. <code>cp /usr/share/fonts/nanum/Nanum* /.../python3.8/site-packages/matplotlib/mpl-data/fonts/ttf/</code> | ||
+ | # 적용을 위해 폰트캐시 삭제. <code>rm -rf ~/.cache/matplotlib/*</code> | ||
+ | |- | ||
+ | |가용폰트 확인 | ||
+ | |matplotlib에서 사용 가능한 폰트리스트를 얻는다. | ||
+ | |<syntaxhighlight lang="python"> | ||
+ | import matplotlib.font_manager | ||
+ | font_list = matplotlib.font_manager.findSystemFonts(fontpaths=None, fontext='ttf') | ||
+ | [matplotlib.font_manager.FontProperties(fname=font).get_name() for font in font_list] | ||
+ | </syntaxhighlight> | ||
+ | |} | ||
[[분류:라이브러리]] | [[분류:라이브러리]] |
2023년 1월 18일 (수) 19:38 기준 최신판
1 개요[편집 | 원본 편집]
1.1 설치[편집 | 원본 편집]
pip install matplotlib
2 각종 팁[편집 | 원본 편집]
의도 | 설명 | 방법 |
---|---|---|
폰트 추가 | 기본적으로 한글폰트가 없어 한글이 표시되지 않곤 한다.
리눅스의 경우, 설치되어 있는데 반영이 안되는 경우도 있다. |
|
가용폰트 확인 | matplotlib에서 사용 가능한 폰트리스트를 얻는다. | import matplotlib.font_manager
font_list = matplotlib.font_manager.findSystemFonts(fontpaths=None, fontext='ttf')
[matplotlib.font_manager.FontProperties(fname=font).get_name() for font in font_list]
|