首页龙虾技能列表 › Matplotlib Chinese Font — Matplotlib 中文字体 — 配置 matplotlib 中文显示

Matplotlib Chinese Font — Matplotlib 中文字体 — 配置 matplotlib 中文显示

v?

配置 matplotlib 中使用中文字体,解决中文字符图表显示乱码问题。

0· 285·0 当前·0 累计

运行时依赖

无特殊依赖

安装命令 点击复制

官方clawhub install matplotlib-chinese-font
镜像加速clawhub install matplotlib-chinese-font --registry https://cn.clawhub-mirror.com

技能文档

简介

配置 matplotlib 中使用中文字体,解决中文字符图表显示乱码问题。

用法

  • 安装必要依赖(如果未安装)
   # 示例依赖安装命令,实际命令可能有所不同
   pip install matplotlib
   
  • 配置并使用中文字体
   import matplotlib.pyplot as plt
   # 示例:配置使用 '宋体' 字体
   plt.rcParams['font.sans-serif'] = ['宋体']
   plt.rcParams['axes.unicode_minus'] = False
   # 示例图表绘制
   plt.plot([1, 2, 3])
   plt.title('中文标题示例')
   plt.show()
   

注意

  • 确保系统中有所选中文字体。
  • 根据实际需求选择合适的中文字体。
数据来源:ClawHub ↗ · 中文优化:龙虾技能库
OpenClaw 技能定制 / 插件定制 / 私有工作流定制

免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制

了解定制服务