cleverly.plotting.style#

cleverly.plotting.style() → Iterator[None][source]#

Draw the caller’s own matplotlib figures in the cleverly style.

The plots in cleverly.plotting set their style on each figure and need no context. This manager is for a caller who wants a figure of their own to match them. It changes rcParams only while the block runs.

Yields:
None

Nothing; draw inside the block.

Examples

>>> import matplotlib
>>> matplotlib.use("Agg")
>>> import matplotlib.pyplot as plt
>>> from cleverly.plotting import style
>>> with style():
...     fig, ax = plt.subplots()
...     line, = ax.plot([0, 1], [0, 1])
>>> line.get_color()
'#2a78d6'
>>> plt.close(fig)