braincell.vis.publication_theme

braincell.vis.publication_theme#

braincell.vis.publication_theme(preset=None, *, rc_overrides=None)[source]#

Activate the PublicationTheme for the duration of a block.

On entry this context manager applies the preset’s branch colours and alphas to _VIS_DEFAULTS and patches matplotlib’s rcParams with the preset’s styling block. On exit both are restored, even if the body raised.

Parameters:
  • preset (PublicationTheme | None) – Theme to activate. When None the default instance is used.

  • rc_overrides (dict[str, object] | None) – Extra rcParams applied on top of the preset. Useful for one-off tweaks without subclassing the preset.

Yields:

VisDefaults – A snapshot of the vis defaults active inside the block.

Notes

The matplotlib patch goes through matplotlib.rcParams.update() and is restored from the original values — this is the same mechanism plt.rc_context() uses internally, but scoped to the keys the preset actually sets so unrelated rc state is left alone.