Skip to content

Styles

We've created a set of default plotting styles that can be called via artlo.plot.set_style(), which updates the matplotlib.rcParams dictionary. You can find the relevant code documentation here.

Important artlo must be imported before matplotlib for these functions to work - this is stupd and annoying, and driven by the order in which different environment variables are set. To get around this, you can directly import important matplotlib classes from artlo:

import artlo
from artlo import mpl # matplotlib module
from artlo import plt # matplotlib.pyplot

artlo.plot.set_style('salo-dark')
plt.plot(...)

salo-dark

style-salo-dark

artlo.plot.set_style('salo-dark')


salo-light

style-salo-light

artlo.plot.set_style('salo-light')


cfo-light

style-cfo-light

artlo.plot.set_style('cfo-light')


For reference, here is the default matplotlib plotting style:

style-default


Code documentation

Lists the available plotting styles.

Returns:

Name Type Description
styles

list of style names to pass to plot.set_style()

Source code in artlo/plot.py
35
36
37
38
39
40
41
42
43
44
45
46
47
def get_styles():
    """Lists the available plotting styles.

    Args:
        None.

    Returns:
        styles: list of style names to pass to `plot.set_style()`
    """

    styles = mpl.style.available

    return styles

Sets a series of plot style parameters.

Parameters:

Name Type Description Default
style

str of the style name to use. from plot.get_styles()

required

Returns:

Type Description

None. Updates matplotlib.rcParams

Source code in artlo/plot.py
22
23
24
25
26
27
28
29
30
31
32
def set_style(style):
    """Sets a series of plot style parameters.

    Args:
        style: str of the style name to use. from `plot.get_styles()`

    Returns:
        None. Updates matplotlib.rcParams
    """

    mpl.style.use(style)