opinionated provides simple, clean stylesheets for plotting with matplotlib and seaborn.
It’s modeled and named after hrbrthemes in R, by hrbrmstr, which are “Opinionated, typographic-centric ggplot2 themes”. It’s not meant to be an exact clone though, I have made a few different choices.
The main application I had in mind was to increase the quality of plots in colab-environments, where there is a very small range of preinstalled fonts. The package therefore automatically downloads fonts from GoogleFonts. But I think everything should also work on your local machine. Be aware though, that it’s not super well-tested, and might e. g. fail with facets.
Installation
pip install opinionated
Usage
The package is very simple to use, you just import it and set the style you want:
import opinionated
plt.style.use("opinionated_rc")
Then you do your plotting:
f, ax = plt.subplots(figsize=(10, 7)) sns.scatterplot(x="bill_length_mm", y="flipper_length_mm", hue='species', data=penguins, s=100, alpha=0.9)
And finally, you can slap on some additional information, using some convenience functions with reasonable defaults. Of course, the usual ways of setting titles, legends, etc. still work.
opinionated.add_legend(title='Species')
opinionated.add_attribution('by Maximilian Noichl')
opinionated.set_title_and_suptitle('Penguins!','They are an excellent type of bird!')
Here’s the result:
This certainly does look better than what the defaults would give you, right? –
You can find more options, stylesheets, etc. in the github-repository!
Metadata
Release files for opinionated 0.0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| opinionated-0.0.3.0.tar.gz | 27.0 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| opinionated-0.0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 43.2 MB
Release files / opinionated-0.0.3.0.tar.gz
| Download URL | opinionated-0.0.3.0.tar.gz |
|---|---|
| Size | 27.0 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
27b96b1e08278310aa2a4a803fa54d5a9ab97b0cecf103e680ece8e131606b3e
|
|
BLAKE2b-256 checksum How to use checksums |
d2a9e6aa9f366dad33df47b2ee98a361cbe3534017d89b1026c4478f682d1232
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.9.19
|
Release files / opinionated-0.0.3.0-py3-none-any.whl
| Download URL | opinionated-0.0.3.0-py3-none-any.whl |
|---|---|
| Size | 16.1 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4710db764a1250bfc45e4696e3f61a3f2def44de5b016effa6458b2bee0edca5
|
|
BLAKE2b-256 checksum How to use checksums |
34b778eddd5c5e6fa9d6fdc6ff82c42c811f3f9d4d7404887aafe615672a3569
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.9.19
|