Skip to content

mpl_themes

mpl_themes

Matplotlib theme for Charité – Universitätsmedizin Berlin (and other registered brands).

theme_charite = partial(theme, brand='charite') module-attribute

Matplotlib rcParams for Charité: theme with brand="charite" (same parameters, positional order kept).

theme_bih = partial(theme, brand='bih') module-attribute

Matplotlib rcParams for the BIH: theme with brand="bih" (same parameters).

theme(font=None, font_size=10, thickness=0.5, grid=False, palette=None, background='white', tiny_margins=False, interactive=False, *, brand=DEFAULT_BRAND)

Return matplotlib rcParams dict for a corporate identity theme.

Parameters:

Name Type Description Default
font str | None

Preferred font family. Falls back through the brand's font stack (for Charité: Charité Text Office → Calibri → DejaVu Sans → sans-serif) if the requested font is not installed.

None
font_size int

Base font size in points. Defaults to 10 for screen; use 8 for print.

10
thickness float

Axis line and tick width. Mirrors the R thickness parameter.

0.5
grid bool

Show major grid lines. Disabled by default.

False
palette str | list[str] | None

Name of one of the brand's palettes or a list of hex color strings used for the axes.prop_cycle. None uses the brand's default palette.

None
background str

Figure and axes background color.

'white'
tiny_margins bool

Minimise all margins around the plot panel. Useful for dense layouts or when saving figures with little surrounding whitespace.

False
interactive bool

Enable matplotlib interactive mode (equivalent to plt.ion()). Useful in notebooks or scripts where you want plots to display without blocking. Matplotlib-specific (Altair charts use .interactive()).

False
brand str | Brand

Registered brand name (default "charite") or a Brand instance. Keyword-only.

DEFAULT_BRAND

enable(**kwargs)

Apply a brand theme (Charité by default) to matplotlib's global rcParams (permanent until reset).

Parameters:

Name Type Description Default
**kwargs

Any parameter accepted by theme (brand, font, font_size, thickness, grid, palette, background, tiny_margins, interactive).

{}

Examples:

from charite_plot.mpl_themes import enable
enable(palette="goldelse", font_size=8)

using(**kwargs)

Temporarily apply a brand theme (Charité by default), restoring the previous rcParams on exit.

Parameters:

Name Type Description Default
**kwargs

Any parameter accepted by theme.

{}

Examples:

from charite_plot.mpl_themes import using
with using(palette="goldelse"):
    fig, ax = plt.subplots()
    ax.plot([1, 2, 3])