Skip to main content

a e s t h e t i c

Project description

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 *_wob style 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()

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

aesthetic-0.10.tar.gz (230.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aesthetic-0.10-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file aesthetic-0.10.tar.gz.

File metadata

  • Download URL: aesthetic-0.10.tar.gz
  • Upload date:
  • Size: 230.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for aesthetic-0.10.tar.gz
Algorithm Hash digest
SHA256 71ce118c3ddb010065c735e3f50485784f726fe93831d19ad8063ec7d0f269e0
MD5 89cace4fa96379f89c8a9f9e36c89d30
BLAKE2b-256 b5393ef89640aa23a274f6ca30d9385de1fc96e661d9b5d97b5828e263a7e3e5

See more details on using hashes here.

File details

Details for the file aesthetic-0.10-py3-none-any.whl.

File metadata

  • Download URL: aesthetic-0.10-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for aesthetic-0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 ef8f9fee36218f791e12fff4398a18df6f4c32f8a44501a4c44f82a0b1e456db
MD5 39c6d51326cdfb9602c38d188bef2e0d
BLAKE2b-256 dd8cf4eb12d73196792aa2c32f6aa18f16731ceb088712c86e149f4ae4b759c0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page