Matplotlib Chinese Font Configuration for Openclaw

A specialized configuration skill to fix garbled Chinese characters and font rendering issues in Matplotlib charts.

tazio7
v1.0.0
Mar 10, 2026
0
1.3k
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install matplotlib-chinese-font

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install matplotlib-chinese-font using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Matplotlib Chinese Font Configuration?

The Matplotlib Chinese Font Configuration skill provides a robust solution for developers and data scientists who need to display Chinese characters in Python-based visualizations. It solves the common 'tofu' problem where Chinese text appears as empty squares by properly configuring system fonts like Heiti TC and Songti SC.

By leveraging this configuration through Openclaw Skills, users can ensure that their data stories are legible and professionally presented for Chinese-speaking audiences. It handles both global configuration for entire projects and granular, element-specific font overrides for complex layouts.

Matplotlib Chinese Font Configuration Use Cases

  • Rendering Chinese titles, axis labels, and legends in Matplotlib plots.
  • Fixing the common issue where negative signs appear as squares when using Chinese fonts.
  • Comparing different Chinese font styles such as Songti and Heiti for aesthetic purposes.
  • Generating localized reports and data visualizations for Chinese users.

How Matplotlib Chinese Font Configuration Works

  1. The skill identifies available Chinese fonts on the host system using the Matplotlib font manager.
  2. It applies a global font configuration using rcParams to set a default Chinese-compatible font family.
  3. It disables the unicode minus sign replacement to ensure mathematical symbols render correctly alongside Chinese text.
  4. For high-precision needs, it allows for per-element font assignment using the fontname parameter.
  5. If font changes are not reflected, it provides a workflow to purge the Matplotlib font cache and re-index system fonts.

Matplotlib Chinese Font Configuration Setup

To get started with this configuration from Openclaw Skills, you can apply the following settings in your Python script:

import matplotlib.pyplot as plt

# Configure Chinese font (e.g., Heiti TC for macOS)
plt.rcParams['font.sans-serif'] = ['Heiti TC'] 
plt.rcParams['axes.unicode_minus'] = False

To verify available fonts or troubleshoot issues, use these commands:

# List all available system fonts
python3 -c "import matplotlib.font_manager as fm; print('\n'.join(sorted(set([f.name for f in fm.fontManager.ttflist]))))"

# Clear font cache if changes don't take effect
rm -rf ~/.matplotlib

Matplotlib Chinese Font Configuration Data Schema & Taxonomy

This skill organizes configuration parameters and helper utilities as follows:

Parameter Type Purpose
font.sans-serif List Defines the priority list of fonts used for rendering Chinese text
axes.unicode_minus Boolean Prevents the minus sign from being garbled in charts
scripts/list_fonts.py Script Detects and lists compatible Chinese fonts available on the system
scripts/clear_cache.py Script Automates the removal of the Matplotlib font cache directory

Matplotlib Chinese Font Configuration Advanced Features

  • Multi-font support allowing different parts of a chart to use different Chinese typefaces.
  • Integration with system-specific font paths for environments where standard font detection fails.
  • Pre-configured scripts for testing font rendering quality before exporting high-resolution images.
  • Support for bbox_inches tight padding to ensure Chinese labels are not cut off during export.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*