Easy font management for matplotlib
Project description
mpl_fontkit
- Use font from google fonts
- Set the font and use it easily
- Helpful error message to get your font name right
Install
pip install mpl_fontkit
Quick Start
import mpl_fontkit as fk
# https://fonts.google.com/specimen/Lato?query=Lato
fk.install("Lato")
If the font does not available in matplotlib, this will download from Google and add it to matplotlib.
To check available styles for a font
fk.font_table("Lato")
And then you are ready to use it in your plots
import matplotlib.pyplot as plt
_, ax = plt.subplots()
ax.set_title("Lato Font", fontdict={"style": "italic",
"weight": 700,
"size": 24})
To set a font manually.
This will update the rcParams
for you.
import mpl_fontkit as fk
fk.set_font("Lato")
Most of the time when you can't get the font to work simply because the font name is not the same as the file name. You can just type a fuzzy name, we will try to find a similar name and show you in the error message.
import mpl_fontkit as fk
fk.set_font("Lat")
LookupError: Cannot find Lat, do you mean: Lato.
Use `.list_fonts()` to list all the available fonts.
Get available fonts
fk.list_fonts()
['Agency FB',
'Algerian',
'Arial',
'Arial Rounded MT Bold',
'Bahnschrift',
'Baskerville Old Face',
'Bauhaus 93',
...]
What fonts look like?
Show one font
fk.show("Lato")
Show all fonts at once
fk.show_fonts()
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
File details
Details for the file mpl_fontkit-0.2.0.tar.gz
.
File metadata
- Download URL: mpl_fontkit-0.2.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5b00d31d660d93b4847e48ab824b233f36adff928a7a65157c1e26f82c0bd94 |
|
MD5 | 0699617b42632aa019009b7eb75240a5 |
|
BLAKE2b-256 | 96435003766ef0ea5d1d297bf4fe1250faa2122b449c7c8b2939a7585d31989c |
Provenance
File details
Details for the file mpl_fontkit-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: mpl_fontkit-0.2.0-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf1731154c7ed77282bb9024a02aeafbf43269cc6c3c2348ed143082abf53354 |
|
MD5 | 8a2ff6dd4bee6f45b034a53dfdf1d1b2 |
|
BLAKE2b-256 | e6e92b1ade662bcf3c9aa79638fa9afaeea65925b724f21a93057ea993ea0789 |