SKILL.md
matplotlib-jp-diagram
This skill provides a standard way to generate matplotlib diagrams with Japanese font support and consistent output naming.
Guidelines
- Mandatory Font Configuration: Always include the following line before plotting:
``python import matplotlib.pyplot as plt plt.rcParams['font.family'] = 'Noto Sans JP' ``
- File Naming Convention:
- The Python script should be named with a suffix like -diagram.py (e.g., performance-diagram.py). - The output image must be a PNG file with the exact same base name (e.g., performance-diagram.png).
- Output Logic:
Ensure the script automatically saves the diagram to the correct PNG path when executed.
``python import os outputpath = os.path.splitext(os.path.basename(file))[0] + ".png" plt.savefig(outputpath) ``
- Appropriate Diagrams:
- Choose the chart type (line, bar, scatter, etc.) that best represents the data. - Include appropriate labels, titles, and legends in Japanese where applicable.
Workflow
- Identify the data to be visualized.
- Determine the script name (e.g.,
stats-diagram.py).
- Generate the script using the template logic.
- If requested, execute the script to verify output.
Reference Template
See [references/template.py](references/template.py) for a complete example structure.