matplotlib
문서의 이전 판입니다!
matplotlib
Animation
한글 출력
- 한글 폰트 설치
- 나눔 폰트 설치
- 폰트 캐시 삭제(폰트를 설치해도 폰트를 찾지 못할때)
- windows: ~/.matplotlib/fontList.cache 삭제
- ubuntu: ~/.cache/matplotlib/fontList.cache
import matplotlib import matplotlib.font_manager import matplotlib.pyplot as plt # 'Nanum' 폰트 리스트 출력 print([f.name for f in matplotlib.font_manager.fontManager.ttflist if 'Nanum' in f.name]) # 폰트 변경 matplotlib.rc('font', family="NanumMyeongjo") # or "Noto Sans CJK KR", "Noto Sans Mono CJK KR" plt.title("한글 제목") plt.plot([1, 2, 3], [1, 2, 3])
폰트 사이즈 변경
import matplotlib.pyplot as plt matplotlib.rcParams.update({'font.size': 22}) # or plt.rcParams.update({'font.size': 22}) # tick label size plt.rcParams.update({'xtick.labelsize': 22, 'ytick.labelsize': 22})
ticks format 변경
예제
plt.rcParams.update({'font.family': "NanumMyeongjo"}) # or "Noto Sans CJK KR", "Noto Sans Mono CJK KR" plt.rcParams.update({'font.size': 22}) plt.rcParams.update({'xtick.labelsize': 22, 'ytick.labelsize': 22}) fig, ax = plt.subplots(figsize=(8, 4), clear=True) ax.set_xlabel('Generation') ax.set_ylabel(f'{args.tag}') for cond in dfs: line, = ax.plot(dfs[cond].index, dfs[cond]['50%'], '-', label=cond) ax.fill_between(dfs[cond].index, dfs[cond]['25%'], dfs[cond]['75%'], color=line.get_color(), alpha=0.3) ax.legend() plt.show()
Seaborn
matplotlib.1554235582.txt.gz · 마지막으로 수정됨: (바깥 편집)