Name | mpl_fontkit JSON |
Version |
0.5.1
JSON |
| download |
home_page | None |
Summary | Easy font management for Matplotlib. |
upload_time | 2024-03-31 13:12:33 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | None |
keywords |
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# mpl_fontkit

- Use font from google fonts
- Use icon from font awesome
- Set the font and use it easily
- Helpful error message to get your font name right
### Install
```shell
pip install mpl_fontkit
```
### Quick Start
#### Install Google Fonts
```python
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
```python
fk.font_table("Lato")
```
<img src="https://raw.githubusercontent.com/heatgraphy/mpl-fontkit/main/images/font_tables.svg" width="300">
And then you are ready to use it in your plots
```python
import matplotlib.pyplot as plt
plt.text("Lato Font", fontdict={"style": "italic", "weight": 700, "size": 24})
```
<img src="https://raw.githubusercontent.com/heatgraphy/mpl-fontkit/main/images/in_plot.svg" alt="show in plot" width="300">
#### Install Font Awesome
To install font awesome and use it in your plot.
```python
fk.install_fontawesome()
plt.text(.5, .5, "\uf58b\uf005\uf59b", fontfamily="Font Awesome 6 Free")
```
The font awesome is available as `Font Awesome 6 Free` and
`Font Awesome 6 Brands`, the name of icon is encoded as unicode.
You can search for icons and get the unicode [here](https://fontawesome.com/search).
<img src="https://raw.githubusercontent.com/heatgraphy/mpl-fontkit/main/images/fontawesome.svg" alt="fontawesome showcase" width="200">
#### Set a font globally
To set a font manually.
This will update the `rcParams` for you.
```python
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.
```python
import mpl_fontkit as fk
fk.set_font("Lat")
```
```text
LookupError: Cannot find Lat, do you mean: Lato.
Use `.list_fonts()` to list all the available fonts.
```
#### Get available fonts
```python
fk.list_fonts()
```
```shell
['Agency FB',
'Algerian',
'Arial',
'Arial Rounded MT Bold',
'Bahnschrift',
'Baskerville Old Face',
'Bauhaus 93',
...]
```
#### What fonts look like?
Show one font
```python
fk.show("Lato")
```
<img src="https://raw.githubusercontent.com/heatgraphy/mpl-fontkit/main/images/show.svg" width="200">
Show all fonts at once
```python
fk.show_fonts()
```
Raw data
{
"_id": null,
"home_page": null,
"name": "mpl_fontkit",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": null,
"author": null,
"author_email": "Mr-Milk <zym.zym1220@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/c5/ed/6e2a08f0f67ed21d9c1676e98b90b49ee3051e25d75f0bd9e32769e6a590/mpl_fontkit-0.5.1.tar.gz",
"platform": null,
"description": "# mpl_fontkit\n\n\n\n- Use font from google fonts\n- Use icon from font awesome\n- Set the font and use it easily\n- Helpful error message to get your font name right\n\n### Install\n\n```shell\npip install mpl_fontkit\n```\n\n### Quick Start\n\n\n#### Install Google Fonts\n\n```python\nimport mpl_fontkit as fk\n\n# https://fonts.google.com/specimen/Lato?query=Lato\nfk.install(\"Lato\")\n```\nIf the font does not available in matplotlib,\nthis will download from Google and add it to\nmatplotlib.\n\nTo check available styles for a font\n```python\nfk.font_table(\"Lato\")\n```\n<img src=\"https://raw.githubusercontent.com/heatgraphy/mpl-fontkit/main/images/font_tables.svg\" width=\"300\">\n\nAnd then you are ready to use it in your plots\n\n```python\nimport matplotlib.pyplot as plt\nplt.text(\"Lato Font\", fontdict={\"style\": \"italic\", \"weight\": 700, \"size\": 24})\n```\n<img src=\"https://raw.githubusercontent.com/heatgraphy/mpl-fontkit/main/images/in_plot.svg\" alt=\"show in plot\" width=\"300\">\n\n#### Install Font Awesome\n\nTo install font awesome and use it in your plot.\n```python\nfk.install_fontawesome()\n\nplt.text(.5, .5, \"\\uf58b\\uf005\\uf59b\", fontfamily=\"Font Awesome 6 Free\")\n```\n\nThe font awesome is available as `Font Awesome 6 Free` and\n`Font Awesome 6 Brands`, the name of icon is encoded as unicode.\n\nYou can search for icons and get the unicode [here](https://fontawesome.com/search).\n\n<img src=\"https://raw.githubusercontent.com/heatgraphy/mpl-fontkit/main/images/fontawesome.svg\" alt=\"fontawesome showcase\" width=\"200\">\n\n#### Set a font globally\n\nTo set a font manually. \nThis will update the `rcParams` for you.\n\n```python\nimport mpl_fontkit as fk\n\nfk.set_font(\"Lato\")\n```\n\nMost of the time when you can't get the font to work\nsimply because the font name is not the same as the file name.\nYou can just type a fuzzy name, we will try to find\na similar name and show you in the error message.\n\n```python\nimport mpl_fontkit as fk\n\nfk.set_font(\"Lat\")\n```\n```text\nLookupError: Cannot find Lat, do you mean: Lato. \n Use `.list_fonts()` to list all the available fonts.\n```\n\n#### Get available fonts\n\n```python\nfk.list_fonts()\n```\n```shell\n['Agency FB',\n 'Algerian',\n 'Arial',\n 'Arial Rounded MT Bold',\n 'Bahnschrift',\n 'Baskerville Old Face',\n 'Bauhaus 93',\n ...]\n \n ```\n\n#### What fonts look like?\n\nShow one font\n```python\nfk.show(\"Lato\")\n```\n<img src=\"https://raw.githubusercontent.com/heatgraphy/mpl-fontkit/main/images/show.svg\" width=\"200\">\n\nShow all fonts at once\n```python\nfk.show_fonts()\n```",
"bugtrack_url": null,
"license": null,
"summary": "Easy font management for Matplotlib.",
"version": "0.5.1",
"project_urls": {
"Homepage": "https://github.com/Marsilea-viz/mpl_fontkit"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "fa1f87298a2ff57b282f50ee42168b79905614c976bd6c43eedb3c96aa9785b8",
"md5": "5d0d6d7e75af85a41536c9aad2761b4a",
"sha256": "162bdb75b9f27021a97fc997a62c81e001f8caa36ebe6d8df1595d7385af5b86"
},
"downloads": -1,
"filename": "mpl_fontkit-0.5.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5d0d6d7e75af85a41536c9aad2761b4a",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.8",
"size": 5528,
"upload_time": "2024-03-31T13:12:32",
"upload_time_iso_8601": "2024-03-31T13:12:32.393915Z",
"url": "https://files.pythonhosted.org/packages/fa/1f/87298a2ff57b282f50ee42168b79905614c976bd6c43eedb3c96aa9785b8/mpl_fontkit-0.5.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "c5ed6e2a08f0f67ed21d9c1676e98b90b49ee3051e25d75f0bd9e32769e6a590",
"md5": "2b24e5a457d1058833a85cd4b9fa8fd9",
"sha256": "8f23b529c5db435b2125c3a66324a243cf2f49d0fe65927de5f7604c69fc2200"
},
"downloads": -1,
"filename": "mpl_fontkit-0.5.1.tar.gz",
"has_sig": false,
"md5_digest": "2b24e5a457d1058833a85cd4b9fa8fd9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 46376,
"upload_time": "2024-03-31T13:12:33",
"upload_time_iso_8601": "2024-03-31T13:12:33.997247Z",
"url": "https://files.pythonhosted.org/packages/c5/ed/6e2a08f0f67ed21d9c1676e98b90b49ee3051e25d75f0bd9e32769e6a590/mpl_fontkit-0.5.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-31 13:12:33",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Marsilea-viz",
"github_project": "mpl_fontkit",
"github_not_found": true,
"lcname": "mpl_fontkit"
}