rcParams — 기본값 프로그래밍 방식 설정
rcParams는 Matplotlib의 모든 기본 설정을 담은 딕셔너리입니다. 한 번 설정하면 이후 모든 차트에 자동 적용됩니다.
import matplotlib.pyplot as pltimport matplotlibmatplotlib.rcParams['font.family'] = 'Malgun Gothic'matplotlib.rcParams['axes.unicode_minus'] = Falsematplotlib.rcParams['figure.figsize'] = (10, 6)matplotlib.rcParams['font.size'] = 12matplotlib.rcParams['axes.titlesize'] = 16matplotlib.rcParams['axes.labelsize'] = 13matplotlib.rcParams['lines.linewidth'] = 2matplotlib.rcParams['grid.alpha'] = 0.4matplotlib.rcParams['grid.linestyle'] = '--'
자주 쓰는 rcParams 항목
| 키 | 설명 | 기본값 |
|---|---|---|
figure.figsize |
Figure 크기 | [6.4, 4.8] |
figure.dpi |
화면 해상도 | 100 |
font.size |
기본 폰트 크기 | 10 |
axes.titlesize |
제목 크기 | 'large' |
axes.labelsize |
축 레이블 크기 | 'medium' |
lines.linewidth |
기본 선 굵기 | 1.5 |
axes.grid |
그리드 기본 표시 여부 | False |
초기화
matplotlib.rcdefaults() # 모든 설정을 기본값으로 초기화