Skip to content

ferrum.encoding

Encoding channels — declarative mappings from data fields to visual variables.

X

Bases: ChannelBase

Positional X channel — maps a field to the horizontal axis.

Parameters:

Name Type Description Default
field str

Column name in the input DataFrame.

None
type_ ('Q', 'N', 'O', 'T')

Data type: quantitative, nominal, ordinal, temporal. Inferred from the column dtype when omitted.

"Q"
bin bool or Bin

If truthy, bin the field before mapping. Pass a Bin(...) instance to control bin width or count; True uses automatic binning.

required
aggregate str

Aggregation operation applied before mapping (e.g. "mean", "sum", "count").

required
scale Scale

Explicit scale override (e.g. LogScale(), LinearScale()).

required
title str

Axis title override. When omitted the field name is used.

required
Notes

axis, legend, sort, stack, and impute kwargs are accepted and forwarded to the EncodingSpec; per-channel axis/legend customization depends on Rust-side support for the channel.

Examples:

>>> import ferrum as fm
>>> fm.Chart(df).encode(x=fm.X("hp", type_="Q"))
>>> fm.Chart(df).encode(x=fm.X("hp", bin=True))
>>> fm.Chart(df).encode(x=fm.X("hp", aggregate="mean"))

to_encoding_spec_dict

to_encoding_spec_dict() -> dict

Return kwargs for the Rust EncodingSpec constructor / serde JSON.

to_implicit_transforms

to_implicit_transforms() -> list

Return a list of transform objects derived from kwargs (bin, aggregate).

Y

Bases: ChannelBase

Positional Y channel — maps a field to the vertical axis.

Parameters:

Name Type Description Default
field str

Column name in the input DataFrame.

None
type_ ('Q', 'N', 'O', 'T')

Data type: quantitative, nominal, ordinal, temporal. Inferred from the column dtype when omitted.

"Q"
bin bool or Bin

If truthy, bin the field before mapping. Pass a Bin(...) instance to control bin width or count; True uses automatic binning.

required
aggregate str

Aggregation operation applied before mapping (e.g. "mean", "sum", "count").

required
scale Scale

Explicit scale override (e.g. LogScale(), LinearScale()).

required
title str

Axis title override. When omitted the field name is used.

required
Notes

axis, legend, sort, stack, and impute kwargs are accepted and forwarded to the EncodingSpec; per-channel axis/legend customization depends on Rust-side support for the channel.

Examples:

>>> import ferrum as fm
>>> fm.Chart(df).encode(y=fm.Y("mpg", type_="Q"))
>>> fm.Chart(df).encode(y=fm.Y("mpg", aggregate="mean"))

to_encoding_spec_dict

to_encoding_spec_dict() -> dict

Return kwargs for the Rust EncodingSpec constructor / serde JSON.

to_implicit_transforms

to_implicit_transforms() -> list

Return a list of transform objects derived from kwargs (bin, aggregate).

X2

Bases: ChannelBase

Secondary X channel — maps a field to the second x position.

Used for ranged marks (rule, rect, ribbon) where a mark spans from x to x2 along the horizontal axis.

Parameters:

Name Type Description Default
field str

Column name in the input DataFrame.

None
type_ ('Q', 'N', 'O', 'T')

Data type. Inferred from the column dtype when omitted.

"Q"
Notes

bin, aggregate, scale, and title kwargs are accepted but are reserved for future use (no-op today) — they trigger a one-time deprecation warning.

Examples:

>>> import ferrum as fm
>>> fm.Chart(df).encode(x=fm.X("start"), x2=fm.X2("end"))

to_encoding_spec_dict

to_encoding_spec_dict() -> dict

Return kwargs for the Rust EncodingSpec constructor / serde JSON.

to_implicit_transforms

to_implicit_transforms() -> list

Return a list of transform objects derived from kwargs (bin, aggregate).

Y2

Bases: ChannelBase

Secondary Y channel — maps a field to the second y position.

Used for ranged marks (rule, rect, ribbon) where a mark spans from y to y2 along the vertical axis.

Parameters:

Name Type Description Default
field str

Column name in the input DataFrame.

None
type_ ('Q', 'N', 'O', 'T')

Data type. Inferred from the column dtype when omitted.

"Q"
Notes

bin, aggregate, scale, and title kwargs are accepted but are reserved for future use (no-op today) — they trigger a one-time deprecation warning.

Examples:

>>> import ferrum as fm
>>> fm.Chart(df).encode(y=fm.Y("low"), y2=fm.Y2("high"))

to_encoding_spec_dict

to_encoding_spec_dict() -> dict

Return kwargs for the Rust EncodingSpec constructor / serde JSON.

to_implicit_transforms

to_implicit_transforms() -> list

Return a list of transform objects derived from kwargs (bin, aggregate).

XError

Bases: ChannelBase

X-axis error channel — maps a field to symmetric error around x.

The error bar extends x ± x_error along the horizontal axis.

Parameters:

Name Type Description Default
field str

Column name whose values are the error magnitude.

None
type_ ('Q', 'N', 'O', 'T')

Data type. Inferred from the column dtype when omitted.

"Q"
Notes

Other kwargs are accepted but are reserved for future use (no-op today) — they trigger a one-time deprecation warning.

Examples:

>>> import ferrum as fm
>>> fm.Chart(df).encode(x="mean_hp", x_error=fm.XError("ci_hp"))

to_encoding_spec_dict

to_encoding_spec_dict() -> dict

Return kwargs for the Rust EncodingSpec constructor / serde JSON.

to_implicit_transforms

to_implicit_transforms() -> list

Return a list of transform objects derived from kwargs (bin, aggregate).

YError

Bases: ChannelBase

Y-axis error channel — maps a field to symmetric error around y.

The error bar extends y ± y_error along the vertical axis.

Parameters:

Name Type Description Default
field str

Column name whose values are the error magnitude.

None
type_ ('Q', 'N', 'O', 'T')

Data type. Inferred from the column dtype when omitted.

"Q"
Notes

Other kwargs are accepted but are reserved for future use (no-op today) — they trigger a one-time deprecation warning.

Examples:

>>> import ferrum as fm
>>> fm.Chart(df).encode(y="mean_mpg", y_error=fm.YError("ci_mpg"))

to_encoding_spec_dict

to_encoding_spec_dict() -> dict

Return kwargs for the Rust EncodingSpec constructor / serde JSON.

to_implicit_transforms

to_implicit_transforms() -> list

Return a list of transform objects derived from kwargs (bin, aggregate).

XError2

Bases: ChannelBase

Secondary x-axis error channel — for asymmetric error bounds.

When paired with XError, sets the upper bound of the error bar independently of the lower bound, enabling asymmetric error bars.

Parameters:

Name Type Description Default
field str

Column name whose values are the upper-side error magnitude.

None
type_ ('Q', 'N', 'O', 'T')

Data type. Inferred from the column dtype when omitted.

"Q"
Notes

Other kwargs are accepted but are reserved for future use (no-op today) — they trigger a one-time deprecation warning.

Examples:

>>> import ferrum as fm
>>> fm.Chart(df).encode(
...     x="mean_hp",
...     x_error=fm.XError("err_low"),
...     x_error2=fm.XError2("err_high"),
... )

to_encoding_spec_dict

to_encoding_spec_dict() -> dict

Return kwargs for the Rust EncodingSpec constructor / serde JSON.

to_implicit_transforms

to_implicit_transforms() -> list

Return a list of transform objects derived from kwargs (bin, aggregate).

YError2

Bases: ChannelBase

Secondary y-axis error channel — for asymmetric error bounds.

When paired with YError, sets the upper bound of the error bar independently of the lower bound, enabling asymmetric error bars.

Parameters:

Name Type Description Default
field str

Column name whose values are the upper-side error magnitude.

None
type_ ('Q', 'N', 'O', 'T')

Data type. Inferred from the column dtype when omitted.

"Q"
Notes

Other kwargs are accepted but are reserved for future use (no-op today) — they trigger a one-time deprecation warning.

Examples:

>>> import ferrum as fm
>>> fm.Chart(df).encode(
...     y="mean_mpg",
...     y_error=fm.YError("err_low"),
...     y_error2=fm.YError2("err_high"),
... )

to_encoding_spec_dict

to_encoding_spec_dict() -> dict

Return kwargs for the Rust EncodingSpec constructor / serde JSON.

to_implicit_transforms

to_implicit_transforms() -> list

Return a list of transform objects derived from kwargs (bin, aggregate).

Theta

Bases: ChannelBase

Polar angle channel — maps a field to the angular position in polar coords.

Typically used with arc or pie marks; the field values determine the sweep angle of each arc segment.

Parameters:

Name Type Description Default
field str

Column name in the input DataFrame.

None
type_ ('Q', 'N', 'O', 'T')

Data type. Inferred from the column dtype when omitted.

"Q"
stack bool or str

Stacking behaviour for arc segments. True enables stacking; False disables it; "normalize" produces percentage arcs.

required
Notes

Requires CoordPolar() on the chart to activate polar rendering; without it the channel is registered but the mark renders in Cartesian space.

Other kwargs are accepted but are reserved for future use (no-op today) — they trigger a one-time deprecation warning.

Examples:

>>> import ferrum as fm
>>> fm.Chart(df).encode(theta=fm.Theta("count", stack=True))

to_encoding_spec_dict

to_encoding_spec_dict() -> dict

Return kwargs for the Rust EncodingSpec constructor / serde JSON.

to_implicit_transforms

to_implicit_transforms() -> list

Return a list of transform objects derived from kwargs (bin, aggregate).

Radius

Bases: ChannelBase

Polar radius channel — maps a field to the radial position in polar coords.

Controls how far each mark is placed from the center of the polar plot.

Parameters:

Name Type Description Default
field str

Column name in the input DataFrame.

None
type_ ('Q', 'N', 'O', 'T')

Data type. Inferred from the column dtype when omitted.

"Q"
Notes

Requires CoordPolar() on the chart to activate polar rendering; without it the channel is registered but the mark renders in Cartesian space.

Other kwargs are accepted but are reserved for future use (no-op today) — they trigger a one-time deprecation warning.

Examples:

>>> import ferrum as fm
>>> fm.Chart(df).encode(theta=fm.Theta("count"), radius=fm.Radius("distance"))

to_encoding_spec_dict

to_encoding_spec_dict() -> dict

Return kwargs for the Rust EncodingSpec constructor / serde JSON.

to_implicit_transforms

to_implicit_transforms() -> list

Return a list of transform objects derived from kwargs (bin, aggregate).

Color

Bases: ChannelBase

Color encoding channel — maps a field to mark color (fill and stroke).

Parameters:

Name Type Description Default
field str

Column name to map to color.

None
type_ ('Q', 'N', 'O', 'T')

Data type: quantitative, nominal, ordinal, temporal. Inferred from the column dtype when omitted.

"Q"
scheme str

Named color scheme for categorical data (e.g. "tableau10", "set1"). Only honored for the Color channel; other channels treat this kwarg as a no-op.

required
scale Scale

Explicit scale override (e.g. ColorScale.Continuous("viridis")).

required
title str

Legend title override. When omitted the field name is used.

required
Notes

legend is honored: passing legend={"disabled": True}, legend=None, or legend=False suppresses the color legend in the rendered SVG. sort is honored: pass a list of strings to set the explicit domain order for the color scale. condition is accepted but reserved for future use.

Examples:

>>> import ferrum as fm
>>> fm.Chart(df).encode(x="hp", y="mpg", color=fm.Color("cyl"))
>>> fm.Chart(df).encode(x="hp", y="mpg", color=fm.Color("origin", scheme="set1"))

to_encoding_spec_dict

to_encoding_spec_dict() -> dict

Return kwargs for the Rust EncodingSpec constructor / serde JSON.

to_implicit_transforms

to_implicit_transforms() -> list

Return a list of transform objects derived from kwargs (bin, aggregate).

Fill

Bases: ChannelBase

Fill color channel — maps a field to filled-mark fill color.

Distinct from stroke, which controls only the outline color. When both Fill and Color are encoded, Fill takes precedence for the interior of the mark.

Parameters:

Name Type Description Default
field str

Column name to map to fill color.

None
type_ ('Q', 'N', 'O', 'T')

Data type. Inferred from the column dtype when omitted.

"Q"
Notes

scale, title, legend, and condition kwargs are accepted but are reserved for future use (no-op today) — they trigger a one-time deprecation warning.

Examples:

>>> import ferrum as fm
>>> fm.Chart(df).encode(x="hp", y="mpg", fill=fm.Fill("origin"))

to_encoding_spec_dict

to_encoding_spec_dict() -> dict

Return kwargs for the Rust EncodingSpec constructor / serde JSON.

to_implicit_transforms

to_implicit_transforms() -> list

Return a list of transform objects derived from kwargs (bin, aggregate).

Stroke

Bases: ChannelBase

Stroke color channel — maps a field to mark stroke (outline) color.

Distinct from fill, which controls only the interior color.

Parameters:

Name Type Description Default
field str

Column name to map to stroke color.

None
type_ ('Q', 'N', 'O', 'T')

Data type. Inferred from the column dtype when omitted.

"Q"
Notes

scale, title, legend, and condition kwargs are accepted but are reserved for future use (no-op today) — they trigger a one-time deprecation warning.

Examples:

>>> import ferrum as fm
>>> fm.Chart(df).encode(x="hp", y="mpg", stroke=fm.Stroke("origin"))

to_encoding_spec_dict

to_encoding_spec_dict() -> dict

Return kwargs for the Rust EncodingSpec constructor / serde JSON.

to_implicit_transforms

to_implicit_transforms() -> list

Return a list of transform objects derived from kwargs (bin, aggregate).

Opacity

Bases: ChannelBase

Opacity channel — maps a field to overall mark opacity.

Controls both fill and stroke opacity simultaneously. Values are mapped to the range [0, 1].

Parameters:

Name Type Description Default
field str

Column name to map to opacity.

None
type_ ('Q', 'N', 'O', 'T')

Data type. Inferred from the column dtype when omitted.

"Q"
scale Scale

Explicit scale override.

required
title str

Legend title override.

required
Notes

legend and condition kwargs are accepted but are reserved for future use (no-op today) — they trigger a one-time deprecation warning.

Examples:

>>> import ferrum as fm
>>> fm.Chart(df).encode(x="hp", y="mpg", opacity=fm.Opacity("year"))

to_encoding_spec_dict

to_encoding_spec_dict() -> dict

Return kwargs for the Rust EncodingSpec constructor / serde JSON.

to_implicit_transforms

to_implicit_transforms() -> list

Return a list of transform objects derived from kwargs (bin, aggregate).

FillOpacity

Bases: ChannelBase

Fill-opacity channel — maps a field to fill opacity.

Independent of stroke opacity; controls only how transparent the interior of a mark is. Values are mapped to the range [0, 1].

Parameters:

Name Type Description Default
field str

Column name to map to fill opacity.

None
type_ ('Q', 'N', 'O', 'T')

Data type. Inferred from the column dtype when omitted.

"Q"
Notes

scale, title, legend, and condition kwargs are accepted but are reserved for future use (no-op today) — they trigger a one-time deprecation warning.

Examples:

>>> import ferrum as fm
>>> fm.Chart(df).encode(x="hp", y="mpg", fill_opacity=fm.FillOpacity("density"))

to_encoding_spec_dict

to_encoding_spec_dict() -> dict

Return kwargs for the Rust EncodingSpec constructor / serde JSON.

to_implicit_transforms

to_implicit_transforms() -> list

Return a list of transform objects derived from kwargs (bin, aggregate).

StrokeOpacity

Bases: ChannelBase

Stroke-opacity channel — maps a field to stroke opacity.

Independent of fill opacity; controls only how transparent the outline of a mark is. Values are mapped to the range [0, 1].

Parameters:

Name Type Description Default
field str

Column name to map to stroke opacity.

None
type_ ('Q', 'N', 'O', 'T')

Data type. Inferred from the column dtype when omitted.

"Q"
Notes

scale, title, legend, and condition kwargs are accepted but are reserved for future use (no-op today) — they trigger a one-time deprecation warning.

Examples:

>>> import ferrum as fm
>>> fm.Chart(df).encode(x="hp", y="mpg", stroke_opacity=fm.StrokeOpacity("year"))

to_encoding_spec_dict

to_encoding_spec_dict() -> dict

Return kwargs for the Rust EncodingSpec constructor / serde JSON.

to_implicit_transforms

to_implicit_transforms() -> list

Return a list of transform objects derived from kwargs (bin, aggregate).

StrokeWidth

Bases: ChannelBase

Stroke-width channel — maps a field to stroke width in pixels.

Larger values produce thicker mark outlines.

Parameters:

Name Type Description Default
field str

Column name to map to stroke width.

None
type_ ('Q', 'N', 'O', 'T')

Data type. Inferred from the column dtype when omitted.

"Q"
Notes

scale, title, legend, and condition kwargs are accepted but are reserved for future use (no-op today) — they trigger a one-time deprecation warning.

Examples:

>>> import ferrum as fm
>>> fm.Chart(df).encode(x="x", y="y", stroke_width=fm.StrokeWidth("importance"))

to_encoding_spec_dict

to_encoding_spec_dict() -> dict

Return kwargs for the Rust EncodingSpec constructor / serde JSON.

to_implicit_transforms

to_implicit_transforms() -> list

Return a list of transform objects derived from kwargs (bin, aggregate).

StrokeDash

Bases: ChannelBase

Stroke-dash channel — maps a field to a dash pattern.

Each level of the field maps to a distinct dash-gap pattern for the mark stroke (e.g. solid, dashed, dotted).

Parameters:

Name Type Description Default
field str

Column name (typically nominal or ordinal) to map to dash pattern.

None
type_ ('Q', 'N', 'O', 'T')

Data type. Inferred from the column dtype when omitted.

"Q"
Notes

scale, title, legend, and condition kwargs are accepted but are reserved for future use (no-op today) — they trigger a one-time deprecation warning.

Examples:

>>> import ferrum as fm
>>> fm.Chart(df).encode(x="x", y="y", stroke_dash=fm.StrokeDash("group", type_="N"))

to_encoding_spec_dict

to_encoding_spec_dict() -> dict

Return kwargs for the Rust EncodingSpec constructor / serde JSON.

to_implicit_transforms

to_implicit_transforms() -> list

Return a list of transform objects derived from kwargs (bin, aggregate).

Size

Bases: ChannelBase

Size channel — maps a field to mark size (point area in square pixels).

For point marks the size value corresponds to the area of the mark in square pixels.

Parameters:

Name Type Description Default
field str

Column name to map to size.

None
type_ ('Q', 'N', 'O', 'T')

Data type. Inferred from the column dtype when omitted.

"Q"
scale Scale

Explicit scale override.

required
title str

Legend title override.

required
Notes

legend and condition kwargs are accepted but are reserved for future use (no-op today) — they trigger a one-time deprecation warning.

Examples:

>>> import ferrum as fm
>>> fm.Chart(df).encode(x="hp", y="mpg", size=fm.Size("weight"))

to_encoding_spec_dict

to_encoding_spec_dict() -> dict

Return kwargs for the Rust EncodingSpec constructor / serde JSON.

to_implicit_transforms

to_implicit_transforms() -> list

Return a list of transform objects derived from kwargs (bin, aggregate).

Shape

Bases: ChannelBase

Shape channel — maps a categorical field to point shape.

Supported shapes include "circle", "square", "triangle", "cross", "diamond", and "star".

Parameters:

Name Type Description Default
field str

Column name (should be nominal or ordinal) to map to shape.

None
type_ ('Q', 'N', 'O', 'T')

Data type. Inferred from the column dtype when omitted; "N" is the most common choice.

"Q"
scale Scale

Explicit scale override.

required
title str

Legend title override.

required
Notes

legend and condition kwargs are accepted but are reserved for future use (no-op today) — they trigger a one-time deprecation warning.

Examples:

>>> import ferrum as fm
>>> fm.Chart(df).encode(x="hp", y="mpg", shape=fm.Shape("origin", type_="N"))

to_encoding_spec_dict

to_encoding_spec_dict() -> dict

Return kwargs for the Rust EncodingSpec constructor / serde JSON.

to_implicit_transforms

to_implicit_transforms() -> list

Return a list of transform objects derived from kwargs (bin, aggregate).

Angle

Bases: ChannelBase

Angle channel — maps a field to mark rotation in degrees.

Rotates each mark around its center point. A value of 0 is upright; values increase clockwise.

Parameters:

Name Type Description Default
field str

Column name to map to rotation angle.

None
type_ ('Q', 'N', 'O', 'T')

Data type. Inferred from the column dtype when omitted.

"Q"
Notes

scale, title, legend, and condition kwargs are accepted but are reserved for future use (no-op today) — they trigger a one-time deprecation warning.

Examples:

>>> import ferrum as fm
>>> fm.Chart(df).encode(x="x", y="y", angle=fm.Angle("direction"))

to_encoding_spec_dict

to_encoding_spec_dict() -> dict

Return kwargs for the Rust EncodingSpec constructor / serde JSON.

to_implicit_transforms

to_implicit_transforms() -> list

Return a list of transform objects derived from kwargs (bin, aggregate).

Text

Bases: ChannelBase

Text channel — maps a field to text-mark content.

Renders each data point's field value as a text label. Primarily used with the mark_text mark.

Parameters:

Name Type Description Default
field str

Column name whose values are rendered as text.

None
type_ ('Q', 'N', 'O', 'T')

Data type. Inferred from the column dtype when omitted.

"Q"
format str

Number or date format string (e.g. ".2f" for two decimal places, "%b %Y" for abbreviated month and year).

required
formatType str

Format type hint; "number" or "time". Used in combination with format.

required
Notes

Other kwargs are accepted but are reserved for future use (no-op today) — they trigger a one-time deprecation warning.

Examples:

>>> import ferrum as fm
>>> fm.Chart(df).encode(x="x", y="y", text=fm.Text("label"))
>>> fm.Chart(df).encode(x="x", y="y", text=fm.Text("value", format=".1f"))

to_encoding_spec_dict

to_encoding_spec_dict() -> dict

Return kwargs for the Rust EncodingSpec constructor / serde JSON.

to_implicit_transforms

to_implicit_transforms() -> list

Return a list of transform objects derived from kwargs (bin, aggregate).

Detail

Bases: ChannelBase

Detail channel — adds a field to the encoding without a visual variable.

Groups marks by the levels of the field without mapping those levels to any visual property (color, size, shape, etc.). Useful for drawing one line per group in a line chart.

Parameters:

Name Type Description Default
field str

Column name to group by.

None
type_ ('Q', 'N', 'O', 'T')

Data type. Inferred from the column dtype when omitted.

"Q"
Notes

Other kwargs are accepted but are reserved for future use (no-op today) — they trigger a one-time deprecation warning.

Examples:

>>> import ferrum as fm
>>> fm.Chart(df).encode(x="year", y="value", detail=fm.Detail("series"))

to_encoding_spec_dict

to_encoding_spec_dict() -> dict

Return kwargs for the Rust EncodingSpec constructor / serde JSON.

to_implicit_transforms

to_implicit_transforms() -> list

Return a list of transform objects derived from kwargs (bin, aggregate).

Tooltip

Bases: ChannelBase

Tooltip channel — specifies which fields appear in the hover tooltip.

Accepts one or more field names (as strings or TooltipField helpers) that are shown when the viewer hovers over a mark in an interactive renderer.

Parameters:

Name Type Description Default
*fields str or TooltipField

One or more column names or TooltipField(...) instances to include in the tooltip. Passing a single string is equivalent to Tooltip(TooltipField(field)).

()
Notes

type kwarg is accepted but is reserved for future use (no-op today) — it triggers a one-time deprecation warning.

Examples:

>>> import ferrum as fm
>>> fm.Chart(df).encode(x="hp", y="mpg",
...     tooltip=fm.Tooltip("hp", "mpg"))
>>> fm.Chart(df).encode(x="hp", y="mpg",
...     tooltip=fm.Tooltip("hp", fm.TooltipField("cyl", title="Cylinders")))

to_encoding_spec_dict

to_encoding_spec_dict() -> dict

Return kwargs for the Rust EncodingSpec constructor / serde JSON.

to_implicit_transforms

to_implicit_transforms() -> list

Return a list of transform objects derived from kwargs (bin, aggregate).

TooltipField

Bases: ChannelBase

Helper for an individual tooltip field with optional title and format.

Used inside Tooltip(*fields) to customise how a single column is displayed in the hover tooltip. Not used as a top-level encoding channel.

Parameters:

Name Type Description Default
field str

Column name.

None
type_ ('Q', 'N', 'O', 'T')

Data type. Inferred from the column dtype when omitted.

"Q"
title str

Custom tooltip label for this field.

required
format str

Number or date format string (e.g. ".1f", "%Y-%m-%d").

required
formatType str

Format type hint; "number" or "time".

required
Notes

Other kwargs are accepted but are reserved for future use (no-op today) — they trigger a one-time deprecation warning.

Examples:

>>> import ferrum as fm
>>> fm.Chart(df).encode(x="hp", y="mpg",
...     tooltip=fm.Tooltip("hp", fm.TooltipField("mpg", title="MPG", format=".1f")))

to_encoding_spec_dict

to_encoding_spec_dict() -> dict

Return kwargs for the Rust EncodingSpec constructor / serde JSON.

to_implicit_transforms

to_implicit_transforms() -> list

Return a list of transform objects derived from kwargs (bin, aggregate).

Href

Bases: ChannelBase

URL-link channel — maps a field to a clickable URL.

When the chart is rendered in an interactive renderer, marks become clickable hyperlinks pointing to the URL stored in field.

Parameters:

Name Type Description Default
field str

Column name containing the URL string for each mark.

None
type_ ('Q', 'N', 'O', 'T')

Data type. Inferred from the column dtype when omitted.

"Q"
Notes

Other kwargs are accepted but are reserved for future use (no-op today) — they trigger a one-time deprecation warning. Interactive renderers only; SVG export does not embed hyperlinks.

Examples:

>>> import ferrum as fm
>>> fm.Chart(df).encode(x="x", y="y", href=fm.Href("url"))

to_encoding_spec_dict

to_encoding_spec_dict() -> dict

Return kwargs for the Rust EncodingSpec constructor / serde JSON.

to_implicit_transforms

to_implicit_transforms() -> list

Return a list of transform objects derived from kwargs (bin, aggregate).

Description

Bases: ChannelBase

Accessibility description channel — maps a field to per-mark alt text.

The description text is used by screen readers and other accessibility tools to describe each individual mark.

Parameters:

Name Type Description Default
field str

Column name whose values are used as the accessibility description.

None
type_ ('Q', 'N', 'O', 'T')

Data type. Inferred from the column dtype when omitted.

"Q"
Notes

Other kwargs are accepted but are reserved for future use (no-op today) — they trigger a one-time deprecation warning.

Examples:

>>> import ferrum as fm
>>> fm.Chart(df).encode(x="x", y="y", description=fm.Description("alt_text"))

to_encoding_spec_dict

to_encoding_spec_dict() -> dict

Return kwargs for the Rust EncodingSpec constructor / serde JSON.

to_implicit_transforms

to_implicit_transforms() -> list

Return a list of transform objects derived from kwargs (bin, aggregate).

Key

Bases: ChannelBase

Key channel — maps a field to a unique key per mark.

Provides a stable identity for each mark when joining across data updates (e.g. animated transitions or streaming data).

Parameters:

Name Type Description Default
field str

Column name whose values uniquely identify each mark.

None
type_ ('Q', 'N', 'O', 'T')

Data type. Inferred from the column dtype when omitted.

"Q"
Notes

Other kwargs are accepted but are reserved for future use (no-op today) — they trigger a one-time deprecation warning.

Examples:

>>> import ferrum as fm
>>> fm.Chart(df).encode(x="x", y="y", key=fm.Key("id"))

to_encoding_spec_dict

to_encoding_spec_dict() -> dict

Return kwargs for the Rust EncodingSpec constructor / serde JSON.

to_implicit_transforms

to_implicit_transforms() -> list

Return a list of transform objects derived from kwargs (bin, aggregate).

Url

Bases: ChannelBase

Image URL channel — maps a field to a base64 data URL for mark_image tiles.

Each row provides a data:image/...;base64,<payload> URL that is placed as an image tile at the position given by the x and y encodings. Used exclusively with :meth:~ferrum.Chart.mark_image.

Parameters:

Name Type Description Default
field str

Column name containing the base64 data URL for each tile.

None
type_ ('Q', 'N', 'O', 'T')

Data type. Inferred from the column dtype when omitted (typically "N" for string columns).

"Q"

Examples:

>>> import ferrum as fm
>>> fm.Chart(df).mark_image().encode(x="x:Q", y="y:Q", url=fm.Url("data_url"))

to_encoding_spec_dict

to_encoding_spec_dict() -> dict

Return kwargs for the Rust EncodingSpec constructor / serde JSON.

to_implicit_transforms

to_implicit_transforms() -> list

Return a list of transform objects derived from kwargs (bin, aggregate).

Facet

Bases: ChannelBase

Facet channel — splits a chart into a grid by levels of a field.

Wraps the chart into a faceted layout where each panel shows data for one level of the facet field. Pass this channel object to Chart.encode(facet=...).

Parameters:

Name Type Description Default
field str

Column name to facet by.

None
type_ ('Q', 'N', 'O', 'T')

Data type. Inferred from the column dtype when omitted; "N" or "O" are the most common choices.

"Q"
title str

Facet panel title override. When omitted the field name is used.

required
Notes

columns (number of facets per row) is accepted as a kwarg but is reserved for future use (no-op today) — it triggers a one-time deprecation warning. If you need column-wrap control today, use Chart.facet(ncols=N) directly.

Examples:

>>> import ferrum as fm
>>> fm.Chart(df).encode(x="hp", y="mpg", facet=fm.Facet("species")).mark_point()
>>> fm.Chart(df).encode(x="hp", y="mpg").mark_point().facet("species", ncols=3)

to_encoding_spec_dict

to_encoding_spec_dict() -> dict

Return kwargs for the Rust EncodingSpec constructor / serde JSON.

to_implicit_transforms

to_implicit_transforms() -> list

Return a list of transform objects derived from kwargs (bin, aggregate).

FacetRow

Bases: ChannelBase

Facet-row channel — splits a chart into rows by levels of a field.

Pass this channel object to Chart.encode(facet_row=...) to create a row-faceted layout where each row shows data for one level of the field.

Parameters:

Name Type Description Default
field str

Column name to facet rows by.

None
type_ ('Q', 'N', 'O', 'T')

Data type. Inferred from the column dtype when omitted; "N" or "O" are the most common choices.

"Q"
title str

Row-facet title override. When omitted the field name is used.

required
Notes

Other kwargs are accepted but are reserved for future use (no-op today) — they trigger a one-time deprecation warning.

Examples:

>>> import ferrum as fm
>>> fm.Chart(df).encode(x="hp", y="mpg", facet_row=fm.FacetRow("year")).mark_point()

to_encoding_spec_dict

to_encoding_spec_dict() -> dict

Return kwargs for the Rust EncodingSpec constructor / serde JSON.

to_implicit_transforms

to_implicit_transforms() -> list

Return a list of transform objects derived from kwargs (bin, aggregate).

FacetCol

Bases: ChannelBase

Facet-column channel — splits a chart into columns by levels of a field.

Pass this channel object to Chart.encode(facet_col=...) to create a column-faceted layout where each column shows data for one level of the field.

Parameters:

Name Type Description Default
field str

Column name to facet columns by.

None
type_ ('Q', 'N', 'O', 'T')

Data type. Inferred from the column dtype when omitted; "N" or "O" are the most common choices.

"Q"
title str

Column-facet title override. When omitted the field name is used.

required
Notes

Other kwargs are accepted but are reserved for future use (no-op today) — they trigger a one-time deprecation warning.

Examples:

>>> import ferrum as fm
>>> fm.Chart(df).encode(x="hp", y="mpg", facet_col=fm.FacetCol("species")).mark_point()

to_encoding_spec_dict

to_encoding_spec_dict() -> dict

Return kwargs for the Rust EncodingSpec constructor / serde JSON.

to_implicit_transforms

to_implicit_transforms() -> list

Return a list of transform objects derived from kwargs (bin, aggregate).