Skip to content

ferrum.title

Structured title configuration.

Two-line title value class — spec §3.19, Schwabish SB1.

Title dataclass

Chart title with optional subtitle.

Accepted everywhere a title string is accepted: Chart(title=...), Chart.properties(title=...), HConcat/VConcat/Layer(title=...). Passing a bare string is equivalent to Title(text=string).

Parameters:

Name Type Description Default
text str

Primary title text.

required
subtitle str

Secondary line below the title; None suppresses the second line.

None
anchor ('start', 'middle', 'end')

Horizontal anchor.

"start"
offset float

Pixel offset from plot area; defaults to the theme's title_offset.

None
font_size float

Title font size in points.

None
font_weight str

Title font weight (e.g. "600", "bold").

None
color str

Title color as a CSS color string.

None
subtitle_font_size float

Subtitle font size; defaults to font_size * 0.85.

None
subtitle_color str

Subtitle color; defaults to the theme's label_color.

None

Examples:

>>> import ferrum as fm
>>> title = fm.Title("My Chart", subtitle="subtitle text", anchor="start")
>>> fm.Chart(df).mark_point().encode(x="x", y="y").properties(title=title)

to_spec_dict

to_spec_dict() -> dict

Serialize to the dict shape the Rust binding expects.

Only emits non-default fields so the JSON sent to Rust stays minimal and forward-compatible.