coco_pipe.viz.theme#

Attributes#

Functions#

coco_theme([mode, colorblind])

Scope rcParams to a with-block. Safe in notebooks and tests.

set_coco_theme([mode, colorblind])

Set rcParams globally. Use coco_theme() context manager in notebooks/tests.

figure_size([columns, aspect_ratio, width_pt])

Return (width, height) in inches.

save_figure(fig, path, *[, dpi, facecolor, bbox_inches])

Save a Matplotlib figure with coco_pipe defaults.

Module Contents#

coco_pipe.viz.theme.ThemeMode#
coco_pipe.viz.theme.ColorKind#
coco_pipe.viz.theme.DIVERGING: str = 'RdBu_r'#
coco_pipe.viz.theme.SEQUENTIAL: str = 'viridis'#
coco_pipe.viz.theme.QUALITATIVE: str = 'tab10'#
coco_pipe.viz.theme.QUALITATIVE_COLORBLIND: str = 'colorblind'#
coco_pipe.viz.theme.coco_theme(mode='paper', colorblind=False)#

Scope rcParams to a with-block. Safe in notebooks and tests.

Parameters:
coco_pipe.viz.theme.set_coco_theme(mode='paper', colorblind=False)#

Set rcParams globally. Use coco_theme() context manager in notebooks/tests.

Parameters:
Return type:

None

coco_pipe.viz.theme.figure_size(columns=1, aspect_ratio=1.0, width_pt=None)#

Return (width, height) in inches.

Parameters:
Return type:

tuple[float, float]

coco_pipe.viz.theme.save_figure(fig, path, *, dpi=300, facecolor='white', bbox_inches='tight')#

Save a Matplotlib figure with coco_pipe defaults.

Parameters:
  • fig – Matplotlib figure object to save.

  • path (str) – Output path accepted by Figure.savefig.

  • dpi (int) – Output resolution in dots per inch.

  • facecolor (str) – Figure background color.

  • bbox_inches (str) – Bounding-box mode passed to Figure.savefig.

Return type:

None