Matplotlib Japanese Fonts

1.1.0 · active · verified Fri Apr 17

matplotlib-fontja is a Python library designed to easily enable Japanese character display in Matplotlib plots. It automatically detects available Japanese fonts on your system, updates Matplotlib's font cache, and configures `rcParams` to use them. The current version is 1.1.0, with updates typically focusing on compatibility and font detection improvements.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to import `matplotlib-fontja`, apply its font configuration using `set_font()`, and then create a Matplotlib plot that correctly displays Japanese characters.

import matplotlib.pyplot as plt
import matplotlib_fontja

# Configure Matplotlib to use Japanese fonts
matplotlib_fontja.set_font()

# Create a simple plot with Japanese text
plt.figure(figsize=(8, 6))
plt.plot([1, 2, 3], [1, 4, 9])
plt.title('日本語タイトル (Japanese Title)')
plt.xlabel('X軸 (X-axis)')
plt.ylabel('Y軸 (Y-axis)')
plt.grid(True)
plt.show()

view raw JSON →