Python Plot Editable Fonts
Apply this skill before writing any Python data-visualization code.
Mandatory Rule
For every Python plotting task, configure editable vector-font settings first, unless the user explicitly asks not to.
Quick Use
Insert this block near plotting imports:
import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif'] = ['Arial']
plt.rcParams['pdf.fonttype'] = 42
plt.rcParams['ps.fonttype'] = 42
plt.rcParams['svg.fonttype'] = 'none'
Reusable Helper
Use scripts/editable_fonts.py to avoid repeating rcParams setup:
from editable_fonts import enable_editable_vector_fonts
enable_editable_vector_fonts(font_family='Arial')
Workflow
- Detect whether the plotting stack uses matplotlib rendering (matplotlib/seaborn/pandas plotting).
- Apply editable-font rcParams before creating figures.
- Keep these settings in final code unless user requests different font behavior.
- For exports, prefer vector formats (
.pdf,.svg,.eps) when editable text is required.
Limits
For non-matplotlib-native libraries, state that this skill does not guarantee editable text and suggest exporting through matplotlib when feasible.