altair_themes¶
altair_themes
¶
Altair / Vega-Lite theme for Charité – Universitätsmedizin Berlin (and other registered brands).
Register and enable with::
from charite_plot.altair_themes import enable
enable() # default params
enable(palette="goldelse") # custom palette
enable(font="Arial", font_size=13) # font override
theme_charite = partial(theme, brand='charite')
module-attribute
¶
Altair theme config for Charité: theme with brand="charite" (same parameters, positional order kept).
theme_bih = partial(theme, brand='bih')
module-attribute
¶
Altair theme config for the BIH: theme with brand="bih" (same parameters).
theme(font=None, font_size=12, thickness=0.5, grid=False, palette=None, background='white', tiny_margins=False, *, brand=DEFAULT_BRAND)
¶
Return an Altair theme config dict for a corporate identity theme.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
font
|
str | None
|
Preferred font. Falls back through the brand's font stack (for Charité: Charité Text Office → Calibri → DejaVu Sans → sans-serif). |
None
|
font_size
|
int
|
Base font size in pixels. |
12
|
thickness
|
float
|
Axis line and tick width. |
0.5
|
grid
|
bool
|
Show axis grid lines. |
False
|
palette
|
str | list[str] | None
|
Name of one of the brand's palettes or a list of hex colors for the
categorical range. |
None
|
background
|
str
|
Chart background color. |
'white'
|
tiny_margins
|
bool
|
Minimise all paddings around the chart. |
False
|
brand
|
str | Brand
|
Registered brand name (default |
DEFAULT_BRAND
|
enable(brand=DEFAULT_BRAND, **kwargs)
¶
Register and enable a brand theme (Charité by default) in Altair.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
brand
|
str | Brand
|
Registered brand name or |
DEFAULT_BRAND
|
**kwargs
|
Any other parameter accepted by |
{}
|
Examples:
using(brand=DEFAULT_BRAND, **kwargs)
¶
Temporarily enable a brand theme (Charité by default), restoring the previous theme on exit.
Mirrors charite_plot.mpl_themes.using. Charts created (or serialised
with chart.to_json() / chart.to_dict()) inside the with block use
the brand theme; the previously active theme is restored afterwards.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
brand
|
str | Brand
|
Registered brand name or |
DEFAULT_BRAND
|
**kwargs
|
Any other parameter accepted by |
{}
|
Examples:
register(brand=DEFAULT_BRAND)
¶
Register a brand theme (Charité by default) with Altair's theme registry (default params).
The theme is registered under the brand's name, e.g. "charite".