Skip to content

JosephBARBIERDARNAL/pyfonts

Repository files navigation

PyFonts

pyfonts logo

A simple (and reproducible) way to load fonts for matplotlib.

Check out the online documentation.



Installation

Note: pyfonts requires Python 3.9 and above.

You can install pyfonts directly from PyPI with:

pip install pyfonts



Quick start

pyfonts is designed to make the code of your graphs more reproducible by removing the need to add the local path to the font files. For example:

from pyfonts import load_font
import matplotlib.pyplot as plt

font = load_font(
    font_url="https://github.com/google/fonts/raw/main/apache/ultra/Ultra-Regular.ttf"
)

fig, ax = plt.subplots(figsize=(10, 6))
ax.text(
    x=0.5,
    y=0.5,
    s=f"What an easy way to load fonts, isn't it?",
    font=font,
    fontsize=20,
    ha="center",
)
plt.show()

output of quick start



Usage guide

Check out the online documentation.



Contributions

Contributions and feedback are welcome.

There's not much that needs to be implemented at the moment. If you've found a bug or want to request a new feature, open an issue.