AIASys matplotlib 中文字体配置

Configure matplotlib to render Chinese text using pre-installed CJK fonts.

21|12|Updated May 17, 2026
One-click install
npx skills add https://github.com/AIAsys/AIASys --skill aiasys-matplotlib
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: AIASys matplotlib 中文字体配置
Source: https://github.com/AIAsys/AIASys/tree/main/apps/backend/skills/builtin/aiasys-matplotlib-font-skill
Command: npx skills add https://github.com/AIAsys/AIASys --skill aiasys-matplotlib

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Matplotlib's default DejaVu Sans font does not include CJK glyphs, causing all Chinese text in plot titles, labels, legends, and tick marks to render as unreadable tofu squares (□), which breaks the usability of data visualizations for Chinese-speaking users.

Core Features & Use Cases

  • Cross-platform font configuration: Automatically matches and sets the most appropriate pre-installed CJK font for Windows, macOS, and Linux systems.
  • Dual implementation options: Provides a built-in helper for AIASys runtime environments and a self-contained fallback for sandboxed or isolated execution contexts.
  • Troubleshooting support: Includes guidance for clearing matplotlib font caches, listing available CJK fonts, and validating font rendering correctness. Use case: Data analysts, researchers, or developers generating matplotlib plots with Chinese text can use this skill to ensure all text renders correctly without manual font configuration or troubleshooting.

Quick Start

Load the aiasys-matplotlib-font-skill before creating any matplotlib plot that includes Chinese text to automatically apply the correct system font configuration.

Frequently Asked Questions about AIASys matplotlib 中文字体配置

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why does matplotlib render Chinese text as tofu squares?

Matplotlib renders Chinese text as tofu squares because its default DejaVu Sans font lacks CJK glyph support. This Skill resolves the tofu rendering issue by automatically configuring a compatible pre-installed CJK font for your system.

How do I fix Chinese font missing characters in matplotlib plots?

To fix missing Chinese characters in matplotlib plots, load this Skill before creating visualizations to automatically match and set the appropriate pre-installed CJK font, applying the correct system font configuration for titles, labels, and legends.

Does this matplotlib font configuration work across Windows, macOS, and Linux?

Yes, this matplotlib font configuration works across Windows, macOS, and Linux. It automatically matches the most appropriate pre-installed CJK font for each operating system environment without requiring manual font installation.

What is the best way to configure CJK fonts for matplotlib in a sandboxed environment?

The best way to configure CJK fonts in a sandboxed or isolated environment is using a self-contained fallback implementation. This Skill provides a built-in helper for standard runtime environments and a self-contained fallback for isolated execution contexts.

How to clear the matplotlib font cache when Chinese text is still not rendering correctly?

To clear the matplotlib font cache when Chinese text fails to render, use the troubleshooting support provided by this Skill. It includes guidance for clearing font caches, listing available CJK fonts, and validating rendering correctness to ensure proper display.