pmpl.styles
Style application utilities for matplotlib.
Context managers for temporarily applying matplotlib styles.
- pmpl.styles.style(preset='base', **overrides)[source]
Apply a matplotlib style temporarily within a context.
- Parameters:
- Yields:
None
- Raises:
ValueError – If the preset name is not recognized
- Return type:
Example
>>> import matplotlib.pyplot as plt >>> import pmpl >>> with pmpl.style('horizontal'): ... fig, ax = plt.subplots() ... ax.barh(['A', 'B', 'C'], [1, 2, 3]) ... plt.show()
- pmpl.styles.set_defaults(preset='base', **overrides)[source]
Permanently set matplotlib rcParams to a preset style.
Unlike the context manager, this persists for the entire session until explicitly changed again.
- Parameters:
- Raises:
ValueError – If the preset name is not recognized
- Return type:
Example
>>> import pmpl >>> pmpl.set_defaults('vertical') >>> # All subsequent plots will use the vertical style