D:\pycharm professional\PyCharm 2024.2.4\plugins\python-ce\helpers\pycharm_matplotlib_backend\backend_interagg.py:85: UserWarning: Glyph 29575 (\N{CJK UNIFIED IDEOGRAPH-7387}) missing from current font.
self.print_png(buf)

这些警告信息表明 matplotlib 在渲染图形时无法找到某些中文字符的字体支持,导致部分中文显示为缺失的方块。这是因为 matplotlib 默认字体通常不包含中文字符。
- 临时解决方案:在代码中指定支持中文的字体
import matplotlib.pyplot as plt# 指定中文字体 plt.rcParams["font.family"] = ["SimHei", "WenQuanYi Micro Hei", "Heiti TC", "sans-serif"]# 你的代码继续...
添加后: