Force publication-quality, editable fonts in Matplotlib figures.
Project description
scifont
Publication-ready Matplotlib figures with editable text and journal-compliant fonts.
The Problem
As a researcher creating figures for publication, you've likely encountered these issues:
-
Font inconsistencies across environments: Your figures look perfect on your local machine (Windows, macOS, or Linux), but when you run the same code on a server, in a Docker container, or in CI/CD pipelines, the fonts are missing. Arial and Times New Roman aren't available everywhere, causing your figures to break or look different.
-
Uneditable text in vector graphics software: You export your figure as PDF or SVG for final editing in Adobe Illustrator or Inkscape, only to discover that the text is converted to uneditable paths. Fixing a typo or adjusting labels means redrawing the entire figure.
-
Manual journal style configuration: Each journal has specific font and size requirements. You spend hours tweaking Matplotlib's
rcParamsto match Nature's guidelines, then repeat the entire process when submitting to Science or IEEE.
The Solution
scifont solves all three problems with one line of code:
import scifont
scifont.use('nature') # That's it!
What it does:
- ✅ Automatically uses system fonts (Arial, Helvetica, Times New Roman) when available, seamlessly falls back to metric-compatible open-source fonts (Arimo/Tinos) when system fonts are missing
- ✅ Configures Matplotlib to export editable text in PDF/SVG files, so you can fix typos in Adobe Illustrator without redrawing
- ✅ Provides one-line configuration for Nature, Science, Cell, and IEEE style guidelines—no more manual
rcParamstweaking
🚀 Key Features
-
Smart Font Selection: Prioritizes system fonts (Arial, Helvetica, Times New Roman) when available. Automatically falls back to bundled open-source fonts (Arimo, Tinos) when system fonts are missing.
-
Metric-Compatible Fonts: We bundle Arimo and Tinos (Apache 2.0 Licensed) as alternatives to Arial and Times New Roman. They have identical character widths and spacing, so your layout stays exactly the same.
-
Editable Vector Graphics: Automatically configures Matplotlib to export PDFs as
Type 42objects and SVGs as<text>tags. Text remains editable in Adobe Illustrator, Inkscape, and CorelDRAW. -
Journal Presets: One-line configuration for Nature, Science, Cell, and IEEE standards.
-
Publication-Ready Styling: Automatically applies scientific publication best practices, including inward-facing ticks, appropriate line widths, and clean axis styling for professional-looking figures.
📦 Installation
pip install --upgrade scifont
Or install from source:
git clone https://github.com/studentiz/scifont.git
cd scifont
pip install .
⚡ Quick Start
import matplotlib.pyplot as plt
import scifont
# Apply journal style
scifont.use('nature')
# Plot as usual
plt.figure(figsize=(4, 3))
plt.plot([1, 2, 3], [4, 5, 6], label='Data')
plt.title("Editable Text in Nature Style")
plt.xlabel("Time (s)")
plt.ylabel("Velocity (m/s)")
plt.legend()
# Save - text will be editable in Adobe Illustrator!
plt.tight_layout()
plt.savefig("figure.pdf")
plt.savefig("figure.svg")
📖 Supported Journal Styles
| Style | Font Family | Primary Font | Fallback Font | Base Size | Target Journals |
|---|---|---|---|---|---|
'nature' |
Sans-serif | Arial/Helvetica | Arimo | 7 pt | Nature, Nature Comms, Scientific Reports |
'cell' |
Sans-serif | Arial/Helvetica | Arimo | 8 pt | Cell, Molecular Cell, Neuron |
'science' |
Sans-serif | Arial/Helvetica | Arimo | 8 pt | Science, Science Advances |
'ieee' |
Serif | Times New Roman/Times | Tinos | 8 pt | IEEE Transactions, Phys. Rev. Lett. |
Note: You can override any setting using plt.rcParams after calling scifont.use().
🎯 What scifont Does (and Doesn't Do)
What scifont solves:
- ✅ Font consistency across all platforms (Windows, macOS, Linux) and environments (local machines, servers, Docker containers)
- ✅ Editable text in PDF/SVG files—fix typos in Adobe Illustrator without redrawing
- ✅ Journal-compliant font and size settings for major journals
- ✅ True cross-platform compatibility—same code works everywhere
- ✅ Professional figure styling—automatic configuration of ticks, borders, and line widths for publication-ready appearance
What scifont doesn't do:
- ❌ It's not a design tool—you still need to adjust layout, colors, and aesthetics
- ❌ It won't automatically make your figures publication-ready—you'll still need to fine-tune spacing, legends, and annotations
- ❌ It's a configuration helper, not a replacement for manual work
Think of it as a solid foundation. One scifont.use('nature') call replaces dozens of manual rcParams tweaks, but you're still in full control to customize everything afterward.
🛡️ Why Bundle Open-Source Fonts?
Arial and Times New Roman are proprietary fonts owned by Monotype. It's illegal to bundle them in a Python package without a costly license. Also, relying on system fonts alone causes inconsistencies—a plot rendered on Windows or macOS (with Arial) looks different on Linux servers or Docker containers (without Arial).
Our solution: We bundle open-source fonts as fallback fonts. They're:
- Free to use, bundle, and distribute: All bundled fonts use permissive open-source licenses
- Metric-compatible: Identical character widths and spacing to their proprietary counterparts. No layout changes when switching fonts.
Bundled Fonts and Licenses
| Font | License | Purpose | Notes |
|---|---|---|---|
| Arimo | Apache License 2.0 | Sans-serif fallback for Arial/Helvetica | Developed by Steve Matteson for Google. Metric-compatible with Arial. |
| Tinos | Apache License 2.0 | Serif fallback for Times New Roman/Times | Developed by Steve Matteson for Google. Metric-compatible with Times New Roman. |
| Noto Sans SC | SIL Open Font License (OFL) 1.1 | Chinese font fallback | Developed by Google and Adobe. Supports Simplified Chinese characters. |
All bundled fonts are freely available for commercial and non-commercial use, modification, and distribution under their respective licenses.
🔧 Technical Details
By default, scifont.use() applies these Matplotlib settings:
plt.rcParams['pdf.fonttype'] = 42 # Embed TrueType fonts (editable)
plt.rcParams['ps.fonttype'] = 42
plt.rcParams['svg.fonttype'] = 'none' # Don't convert text to paths
This ensures compatibility with Adobe Illustrator, CorelDRAW, and Inkscape.
License
The scifont code is distributed under the MIT License.
The bundled fonts are distributed under their respective open-source licenses:
- Arimo and Tinos: Apache License, Version 2.0
- Noto Sans SC: SIL Open Font License (OFL) 1.1
Disclaimer
Font Licensing: All bundled fonts (Arimo, Tinos, and Noto Sans SC) are open-source and freely available for use, modification, and distribution under their respective licenses. However, users are responsible for ensuring compliance with these licenses in their specific use cases.
No Warranty: This software is provided "as is" without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and noninfringement.
Political Neutrality: The bundled fonts (particularly Noto Sans SC) are technical tools designed for text rendering and do not represent any political stance or affiliation. Users should ensure compliance with local laws and regulations when using these fonts in their jurisdictions.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file scifont-0.1.9.tar.gz.
File metadata
- Download URL: scifont-0.1.9.tar.gz
- Upload date:
- Size: 13.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9657c1cfeace5bc5630295257a9317791c0bfa8abba4c836c27cffb9be11b366
|
|
| MD5 |
1a81c44589dcaf105be730baf6ee4a39
|
|
| BLAKE2b-256 |
e6c7944eab407d5c295126c0b86e6244d658bbd6a144be401a53d48b9a99f814
|
File details
Details for the file scifont-0.1.9-py3-none-any.whl.
File metadata
- Download URL: scifont-0.1.9-py3-none-any.whl
- Upload date:
- Size: 13.9 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83c6d9965ddc55d609b505cae9de7452cd1dd2b45bffcfe5ece178d4e1ee0f7e
|
|
| MD5 |
35596602075ae6d6c4adff9245e4279e
|
|
| BLAKE2b-256 |
d2345d709715bc87172e4f10594c2da6ef95d689598749c70492ffe9a31d9d79
|