milia.plot.theme#
Lets-plot style: twiga’s theme with the milia palette, replaceable as a whole.
Every lets-plot primitive in milia.plot.lets.draw reads its theme,
categorical palette and accent colours from the current Style. A
project with its own branding, such as a book, calls use() once and every
milia.plot.lets figure then renders in that style:
from milia.plot import theme
theme.use(theme=house_theme, palette=HOUSE_PALETTE, primary="#1E293B")
Functions
|
Discrete colour scale on the current palette. |
|
The style every lets-plot primitive uses now. |
|
Discrete fill scale on the current palette. |
|
Restore the default milia style. |
|
The current style's lets-plot theme. |
|
Twiga's lets-plot theme, the default of |
|
Replace the current style, wholly or field by field. |
Classes
|
Everything a lets-plot primitive needs to look on-brand. |
- class milia.plot.theme.Style(theme=<function twiga>, palette=<factory>, primary='#107591', danger='#f69a48', highlight='#f69a48', muted='#525252', background='#FFFFFF')#
Bases:
objectEverything a lets-plot primitive needs to look on-brand.
- Variables:
theme (
Callable[...,Any]) – Callable returning a lets-plot theme; keyword arguments pass through.primary (
str) – Colour of single-series marks and the high end of a sequential fill.danger (
str) – Colour of flagged or out-of-band marks.highlight (
str) – Colour of the one group or mark that the reader should notice.muted (
str) – Colour of reference lines, labels and secondary marks.background (
str) – Colour of tile borders.
Examples
>>> Style(primary="#0369A1").primary '#0369A1'
- milia.plot.theme.color()#
Discrete colour scale on the current palette.
- Return type:
- Returns:
A lets-plot scale.
Examples
>>> color() is not None True
- milia.plot.theme.current()#
The style every lets-plot primitive uses now.
Examples
>>> isinstance(current(), Style) True
- milia.plot.theme.fill()#
Discrete fill scale on the current palette.
- Return type:
- Returns:
A lets-plot scale.
Examples
>>> fill() is not None True
- milia.plot.theme.reset()#
Restore the default milia style.
Examples
>>> reset().palette == Style().palette True
- milia.plot.theme.theme(**kwargs)#
The current style’s lets-plot theme.
- Parameters:
**kwargs (
Any) – Passed to the theme callable, e.g.legend_pos="bottom".- Return type:
- Returns:
The lets-plot theme feature.
Examples
>>> theme() is not None True
- milia.plot.theme.twiga(**kwargs)#
Twiga’s lets-plot theme, the default of
Style.- Parameters:
**kwargs (
Any) – Passed to twiga’stwiga_theme, e.g.legend_pos="bottom".- Return type:
- Returns:
The lets-plot theme feature.
Examples
>>> twiga() is not None True
- milia.plot.theme.use(style=None, **changes)#
Replace the current style, wholly or field by field.
- Parameters:
- Return type:
- Returns:
The style now in effect.
Examples
>>> use(primary="#1E293B").primary '#1E293B' >>> reset() == Style() True