본문 바로가기
Python

[Matplotlib] 그래프 화질 변환

by mimi_Bo 2021. 5. 25.

아래와 같이 한글 폰트가 깨지는 것을 해결한 후에도 화질이 깨져서 그래프가 잘 보이지 않는듯한 느낌이 들때가 있습니다.

mport matplotlib.pyplot as plt
import pandas as pd
import warnings
import matplotlib as mpl

# 폰트 변환
# Windows
mpl.rc("font", family='Malgun Gothic')
# MacOS
# mpl.rc("font", family='AppleGothic')

# 마이너스 사인 수정
mpl.rc('axes', unicode_minus=False)

warnings.filterwarnings("ignore")
%matplotlib inline

이럴 때는 아래의 2가지 방법을 통해 그래프 화질을 개선할 수 있습니다.

방법 1.

import matplotlib as mpl

# 첫번째 방법
%config InlineBackend.figure_format='retina'

방법 2.

import matplotlib as mpl

# 두번째 방법
from IPython.display import set_matplotlib_formats
set_matplotlib_formats('retina')

댓글