a e s t h e t i c
Luke's matplotlib style sheets. Remixed from John Garrett's SciencePlots.
Preferences:
- Avoid constantly repeating matplotlib calls to prettify plots.
- Default font: Arial (not DejaVu Sans, which many systems don't have installed by default)
- Don't draw right and top axis spines unless they provide function.
- White on black reduces eye strain; make generating white on black figures easy by using
*_wobstyle sheets.
install
...via pip: pip install aesthetic
...via local clone: git clone git@github.com:lgbouma/aesthetic.git; cd aesthetic; pip install -e .
examples
for plot styles, see the test driver. the general syntax follows:
from aesthetic import set_style
set_style("clean")
set_style("clean_wob")
set_style("science")
set_style("science_wob")
So if you wanted to make four different versions of the same plot with responsive colors:
from aesthetic.plot import set_style
import numpy as np, matplotlib.pyplot as plt, matplotlib as mpl
def make_plot(style):
x = np.linspace(0,10,1000)
y = (x/100)**3 + 5*np.sin(x)
_x, _y = np.arange(2, 8, 0.5), np.arange(2, 8, 0.5)
fig, ax = plt.subplots(figsize=(3,2.5))
cs = [None]*3 if '_wob' not in style else ['cyan','lime','yellow']
ax.plot(x, y, label=f'style: {style}', color=cs[0])
ax.plot(x, y+3, color=cs[1])
ax.plot(x, y+6, color=cs[2])
_yerr = np.abs(np.random.normal(2, 1, _x.size))
c = 'k' if '_wob' not in style else 'w'
ax.errorbar(_x, _y, yerr=_yerr, marker='o', elinewidth=0.5, lw=0, c=c, markersize=2)
ax.update({ 'xlabel': r'x [units]', 'ylabel': r'y [units]' })
ax.legend(fontsize='small')
return fig
if __name__ == '__main__':
styles = ['clean', 'science', 'clean_wob', 'science_wob']
for style in styles:
set_style(style)
fig = make_plot(style)
fig.savefig(f'../results/plot_{style}.png', bbox_inches='tight', dpi=400)
mpl.rc_file_defaults()
Release files for aesthetic 0.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| aesthetic-0.11.tar.gz | 8.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aesthetic-0.11-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.9 kB
Release files / aesthetic-0.11.tar.gz
| Download URL | aesthetic-0.11.tar.gz |
|---|---|
| Size | 8.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
09c69e2845794a6f904a1f618c51309752c91085e7d5bf193e74ee2b54095902
|
|
BLAKE2b-256 checksum How to use checksums |
7bacc4f64d8c5cedf1c0c2ed5106eed0291f36ca1119eeb4cf7d1a00f3971d79
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / aesthetic-0.11-py3-none-any.whl
| Download URL | aesthetic-0.11-py3-none-any.whl |
|---|---|
| Size | 10.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b0fac9142417f30907473f8ac3fcec0d0bee3f527632174cee41012bf8414eab
|
|
BLAKE2b-256 checksum How to use checksums |
68be963f3be96dc424e1b3d8539f9ac902797371573e1fb755b1bc782724f076
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|