apply_theme

Documentation for eth_defi.vault_report.theme.apply_theme function.

apply_theme(fig, theme, width, height)

Apply the theme to a figure.

Sets the font, colours, size and default axes shared by every report chart. Chart titles are not set here: the branded panel draws them, see eth_defi.vault_report.branding.compose_chart_panel(). The margins and right-hand y axis are defaults only; each create_*_figure function in eth_defi.vault_report.charts overrides them for its labels and legend, so call this first and adjust the layout afterwards.

Sizes are design pixels. The 22 px base font is shown at about 11 px in the blog’s content column, because charts are designed about twice as wide as they are displayed.

Parameters
  • fig (plotly.graph_objs._figure.Figure) – Figure to style in place.

  • theme (eth_defi.vault_report.theme.ChartTheme) – Chart theme.

  • width (int) – Figure width in design pixels.

  • height (int) – Figure height in design pixels.

Returns

The same figure.

Return type

plotly.graph_objs._figure.Figure