python - Custom font in a style sheet in matplotlib - Stack Overflow
I read that you can write and import style sheets for matplotlib
to use. Is there a way to load a font from a custom path in such a file? I know how to load the font directly in my .py
file, but I want to know, can this be done externally? The idea would be to be able to use this style sheet for several projects.
Minimal example:
A style sheet my.mplstyle
:
font.sans-serif : path/to/font/MyFont.otf
The main file main.py
:
import matplotlib.pyplot as plt
plt.style.use("./my.mplstyle")
fig, ax = plt.subplots()
plt.show()
Running python main.py
raises a series of warnings of the form
findfont: Generic family 'sans-serif' not found because none of the following families were found: path/to/font/MyFont.otf
最新文章
- python - How to solve this TensorflowTensorboard compatibility problem? - Stack Overflow
- python - Pipenv not working after Debian system upgrade--maybe partial uninstall? - Stack Overflow
- Vercel hosted SvelteKit app keeps 404ing on form submit? - Stack Overflow
- uiviewcontroller - MacCatalyst Scene Frame needs adjustment - Stack Overflow
- typescript - Issues with generic type narrowing on merged records - Stack Overflow
- Trouble installing homebrew with ansible playbook, linux client and host nodes - Stack Overflow
- c++ - bootloader _start VEZA video buffer - Stack Overflow
- laravel - Customizing Fortify for Multi-Tenant Password Resets Tokens with Domain-Specific Tokens - Stack Overflow
- postgresql - Postgres Postgis ST_DWithin query is not accurate - Stack Overflow
- Need to find a way to change a library (SO file) without reinstalling an application in Android 13 on rooted device. Permission
- Is there a class Nethereum.Signer.Transaction? - Stack Overflow
- datagrid - Mudblazor MudDatagrid SelectedItemChanged problem with ondblclick version 8.0.0-preview - Stack Overflow
- javascript - How do I change file pathing after installation? - Stack Overflow
- angularjs - how to display a pdf in angular? - Stack Overflow
- c++ - Member of struct constructed twice in custom constructor? - Stack Overflow
- amazon web services - Nuxt build fails on AWS Amplify: Failed to find the deploy-manifest.json file in the build output - Stack
- command prompt - byobu - how to disable byobu_prompt_runtime - Stack Overflow