1 parent 33dd1f7 commit 8c9ed2cCopy full SHA for 8c9ed2c
1 file changed
ui/mpl_imports.py
@@ -6,6 +6,20 @@
6
import matplotlib
7
8
matplotlib.use("TkAgg", force=True)
9
+
10
+ # 配置中文字体(防止 DejaVu Sans 缺少 CJK glyph 警告)
11
+ import platform
12
13
+ if platform.system() == "Windows":
14
+ matplotlib.rcParams["font.sans-serif"] = ["Microsoft YaHei", "SimHei", "DejaVu Sans"]
15
+ else:
16
+ matplotlib.rcParams["font.sans-serif"] = ["WenQuanYi Micro Hei", "Noto Sans CJK SC", "DejaVu Sans"]
17
+ matplotlib.rcParams["axes.unicode_minus"] = False
18
19
+ # 抑制缺少 glyph 的 UserWarning(CJK 字体回退时 still noisy)
20
+ import warnings
21
+ warnings.filterwarnings("ignore", message="Glyph.*missing from font.*")
22
23
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
24
from matplotlib.figure import Figure
25
0 commit comments