A simple way to load fonts for matplotlib.
Check out the online documentation.
Note: pyfonts requires Python 3.9 and above.
You can install pyfonts
directly from PyPI with:
pip install pyfonts
(not recommended) Alternatively you can install the development version with:
pip install git+https://github.com/JosephBARBIERDARNAL/pyfonts.git
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"
)
# check how the font looks on a minimalist example
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()
Check out the online documentation.
Contributions (and feedback) are welcome.
- check the issues for ideas
- suggest something (:
Follow the steps below for your OS.
-
Fork the Repository: Fork this repository to your GitHub account.
-
Clone the Repository:
git clone https://github.com/yourusername/pyfonts.git cd pyfonts
-
Set Up a Virtual Environment:
- Mac/Linux:
python -m venv venv source venv/bin/activate
- Windows:
python -m venv venv venv\Scripts\activate
- Mac/Linux:
-
Install Dependencies:
pip install -r requirements-dev.txt pip install -e .
-
Create a Feature Branch:
git checkout -b feature-name
-
Start Coding!