Skip to main content

matfonter

matfonter is a tiny helper package for loading a .ttf or .otf font file into matplotlib and applying it globally before plotting.

Install

Local development install

pip install -e .

PyPI install

pip install matfonter

Usage

matfonter(path_to_font, unicode_minus=False)
  • path_to_font: path to a .ttf or .otf font file
  • unicode_minus: value assigned to plt.rcParams["axes.unicode_minus"]
  • returns: the resolved matplotlib font family name
from matfonter import matfonter
import matplotlib.pyplot as plt

matfonter("/path/to/your/font.ttf", unicode_minus=False)

plt.plot([1, 2, 3], [3, 1, 4])
plt.title("Custom Font Demo")
plt.show()

Example Font

For CJK examples, a good default is Source Han Sans SC Heavy (思源黑体), which is open source under SIL Open Font License 1.1, and also easy to find out the effect - obsolutely bold.

If you only reference the font in examples, your project license can stay MIT. If you redistribute the font file with your package or repo, keep the font under its own OFL-1.1 terms and include the required license notice.

Metadata

Release files for matfonter 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for matfonter 0.1.0
File Size Uploaded Provenance Actions
matfonter-0.1.0.tar.gz 3.7 kB Without provenance Details for matfonter-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for matfonter 0.1.0
File Interpreter ABI Platform Actions
matfonter-0.1.0-py3-none-any.whl Python 3 none any Details for matfonter-0.1.0-py3-none-any.whl

Total release size: 7.3 kB

Release files / matfonter-0.1.0.tar.gz

Download URL matfonter-0.1.0.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f64cbd5fee3abfcde6c51b1b091b58999bf9443442e743845bed4b25d06bbfa5
BLAKE2b-256 checksum
How to use checksums
423fa2df1cfb8706ad19311955cd1f0aff19646c8eea35d02810ef987707c4dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / matfonter-0.1.0-py3-none-any.whl

Download URL matfonter-0.1.0-py3-none-any.whl
Size 3.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
529e166cc4aa22c64b8a279cefdff9a08ae8c41bf2be8dd7aed14fa7730dee4d
BLAKE2b-256 checksum
How to use checksums
0959d07dfbc913b1c49ef14cec866dd7a4b046c6832ce864cdff1633deb337bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Security for matfonter 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page