use_style
Note
This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the Habitat Guide and Python API guide (v2.0) for usage.
- use_style(name: str | StyleSpec) Iterator[StyleSpec][source]
Apply a preset’s rcParams for the duration of the block.
- Parameters:
name – A registered preset name, or a
StyleSpecfor a one-off style that need not be registered.- Yields:
The active
StyleSpec, so the block can read sizes and palette from it.
Example
>>> from habit.viz import use_style, plot_kaplan_meier >>> with use_style("radiology") as style: ... fig = plot_kaplan_meier(...) >>> fig.savefig("km.tiff", dpi=style.dpi)