Skip to content

mpl_themes

mpl_themes

Matplotlib theme for Charité – Universitätsmedizin Berlin.

theme_charite(font=None, font_size=10, thickness=0.5, grid=False, palette='primary', background='white', tiny_margins=False, interactive=False)

Return matplotlib rcParams dict for the Charité corporate identity theme.

Parameters:

Name Type Description Default
font str | None

Preferred font family. Falls back through Charité Text Office → 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]

Name of a built-in palette or a list of hex color strings used for the axes.prop_cycle.

'primary'
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

enable(**kwargs)

Apply the Charité theme to matplotlib's global rcParams (permanent until reset).

Parameters:

Name Type Description Default
**kwargs

Any parameter accepted by :func:theme_charite (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 the Charité theme, restoring the previous rcParams on exit.

Parameters:

Name Type Description Default
**kwargs

Any parameter accepted by :func:theme_charite.

{}

Examples:

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