Styling

Styling

TBD:

The parent font of the figure can be defined by passing it as argument to the constructor Figure(font=...). In non-LaTeX mode, different fonts can be selected for sub-elements (e.g. axis label); otherwise the parent font is used throughout.

Text styling (non-LaTeX)

In non-tex mode, a number of fonts and font-variants are supported, see the appendix for the full list.

The table below is a subset of the supported fonts that are likely to be among the most useful. Note that not all fonts are supported for the SVG/Cairo output (cairo being required when transparency is desired).

You can specify the font you want using its ID or its name (replacing spaces by dashes) for instance:

f = Figure(font="texmr")
f2 = Figure(font="computer-modern-roman")

are both valid way of defining the parent font.

Note 1: most fonts only have basic symbol support (typically Greek letters are fine) but will fail for more "exotic" symbols like ∫ or ∞. Use the LaTeX mode for those. Note 2: the fonts that start with tex are tex-like fonts but do not switch on the LaTeX mode.

IDNameLooks likeSVG/Cairo
pshhelvetica
psprpalatino roman
texcmrcomputer modern roman
texcmsscomputer modern sans serif
texcmttcomputer modern sans serif
arial8arial
rmroman
sssans serif
tttypewriter

Text styling (LaTeX)

In LaTeX mode, you're free to specify your own preamble which can include font packages to define how things should look. Anything that works with PdfLaTeX should work. Below is an example where we use sourcesanspro:

preamble = texpreamble = tex"""
    \usepackage[T1]{fontenc}
    \usepackage[default]{sourcesanspro}
    \usepackage{amssymb}
"""
f = Figure(texpreamble=preamble)

Note: specifying a tex preamble is sufficient to switch to LaTeX mode.