Python, matplotlib 한글 깨짐 (Windows)
정리. 수알치 오상문
간단하게 정리하면,
1. 나눔 글꼴 설치한다.
2. matplotlib 설정 파일에 사용할 글꼴을 설정한다.
나눔글꼴을 찾아서 다운로드하고 압축을 풀어서 C:\Windows\Fonts 경로에 저장합니다.
(Windows 버전에 맞는 글꼴 저장 위치 확인하세요.)
이제 matplotlib 설치 경로 하위의 mpl-data 경로로 이동합니다.
(예; C:\Users\...\AppData\Local\Programs\Python\Python39\Lib\site-packages\matplotlib\mpl-data)
matplotlibrc 파일을 메모장이나 에디터에서 엽니다.
아래 위치를 찾아서 사용할 글꼴 이름을 'Malgun Gothic'으로 설정하고 저장합니다.
-------------------------------------------------------------------------------------
## Note that font.size controls default text sizes. To configure
## special text sizes tick labels, axes, labels, title, etc., see the rc
## settings for axes and ticks. Special text sizes can be defined
## relative to font.size, using the following values: xx-small, x-small,
## small, medium, large, x-large, xx-large, larger, or smaller
## font.family: sans-serif
#font.family: Malgun Gothic
#font.style: normal
#font.variant: normal
#font.weight: normal
#font.stretch: normal
#font.size: 10.0
-------------------------------------------------------------------------------------------
이제 여러분의 matplotlib 코드를 실행하면, 아래 예시 화면처럼 그래프에 한글이 출력될 것입니다.
[참조] https://operstu1.tistory.com/80
<Python matplotlib> matplotlib 한글 폰트 깨짐 수정[진짜 되는 수정] 따라만 하세요
1. 오류의 형태 2. 해결 과정 3. 해결 방법 [바로 해결 방법으로 가실 분은 해결방법을 눌러 이동하세요] 파이썬과 matplotlib 등 모든 언어와 라이브러리가 영어를 주 언어로 사용하다보니 한글 사용
operstu1.tistory.com
'Python 활용' 카테고리의 다른 글
파이썬에서 자바 패키지 및 사용자 자바 기능 호출 (0) | 2023.10.05 |
---|---|
pip install jpype 설치 에러 (0) | 2023.10.05 |
Python + Cython 첫 번째 (0) | 2023.09.06 |
파이썬 실행파일 (EXE) 만들기, 배포, 변환 (0) | 2023.08.05 |
파이썬, 가상환경(venv) 사용 및 배포 파일 생성(pyinstaller) (0) | 2023.07.28 |