-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_cfg_.py
More file actions
32 lines (25 loc) · 983 Bytes
/
_cfg_.py
File metadata and controls
32 lines (25 loc) · 983 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.font_manager as fm
import os
import seaborn as sns
import tkinter as tk
def _set_font(font_path: str = 'C:/Windows/Fonts/NanumGothic.ttf') -> None:
"""
Matplotlib·Seaborn 공통 한글 폰트 설정
"""
if os.path.isfile(font_path):
font_name = fm.FontProperties(fname=font_path).get_name()
# ── Matplotlib
plt.rc('font', family=font_name)
plt.rcParams['axes.unicode_minus'] = False # 마이너스 부호 깨짐 방지
# ── Seaborn(※ 반드시 Matplotlib 설정 이후 호출)
sns.set_theme(font=font_name,
rc={'axes.unicode_minus': False},style="white") # 스타일은 필요 시 추가 지정
else:
print(f'[경고] 지정한 폰트를 찾을 수 없습니다: {font_path}')
_set_font() # 모듈 import 시 자동 실행
__all__ = [
'pd', 'np', 'plt', 'sns', 'tk'
]