Encoding¶
Typed encoding channels — X, Y, Color, Size, Tooltip, and more.
Ferrum — a statistical visualization library with a Rust core.
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
condition is honored: pass a ConditionalSpec built via
sel.when(...).otherwise(...) (or fm.when(sel).then(...).otherwise(...))
to switch rotation based on selection state -- see Chart.encode()'s
condition= translation (ferrum-spec.md §3.10).
Angle draws no legend of its own. legend=None/legend=False are
accepted silently; title= and a legend dict/Legend(...) raise
ValueError at construction, since there is nothing for them to label.
Examples:
to_encoding_spec_dict ¶
Return kwargs for the Rust EncodingSpec constructor / serde JSON.
Iterates this channel's own _honored_kwargs (the single source of
truth) rather than a separate hard-coded key list, so a kwarg is
serialized iff the channel honors it. Each honored key routes through
_SPEC_DICT_HANDLERS to its serializer; keys with no handler
(bin/aggregate) are honored for the warn guard but consumed via
to_implicit_transforms, so they contribute nothing here. legend
is the one key whose serializer depends on more than its own value,
branching on _legend_surface: "own" routes through
_emit_legend; "cascade" (X, Y) routes through
_emit_legend_cascade_only instead, so a bare None/False
cannot suppress a different channel's legend (see that function's
docstring); on "none" legend is not honored, so nothing is
emitted -- _validate_legend_value has already refused every value
except the silent None/False.
Keys are emitted in _SPEC_DICT_ORDER so the dict layout is
stable regardless of frozenset iteration order.
to_implicit_transforms ¶
Return a list of transform objects derived from kwargs (bin, aggregate).
Both bin and aggregate transforms are returned as pending sentinels
rather than concrete Rust objects. chart.to_spec() resolves them:
_PendingBin: single-chart path converts to an unnamedBin(byte-stable); layered path converts to a namedBinfan-out so it does not corrupt the shared unnamed chain._PendingAggregate: defers groupby assignment until all sibling encoding channels are known (Altair-style auto-groupby).
option ¶
Return the value of encoding option name, or default if unset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The option key to look up (e.g. |
required |
default
|
Any
|
Value returned when name is not present. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The option value, or default when the key is absent. |
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 categorical color scheme (e.g. |
required |
scale
|
Scale
|
Explicit scale override (e.g. |
required |
title
|
str
|
Legend title override. When omitted the field name is used. |
required |
bin
|
(bool, dict or Bin)
|
Color by bins of the numeric field: |
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 honored:
pass a ConditionalSpec built via sel.when(...).otherwise(...) (or
fm.when(sel).then(...).otherwise(...)) to switch color based on
selection state -- see Chart.encode()'s condition= translation
(ferrum-spec.md §3.10).
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 ¶
Return kwargs for the Rust EncodingSpec constructor / serde JSON.
Iterates this channel's own _honored_kwargs (the single source of
truth) rather than a separate hard-coded key list, so a kwarg is
serialized iff the channel honors it. Each honored key routes through
_SPEC_DICT_HANDLERS to its serializer; keys with no handler
(bin/aggregate) are honored for the warn guard but consumed via
to_implicit_transforms, so they contribute nothing here. legend
is the one key whose serializer depends on more than its own value,
branching on _legend_surface: "own" routes through
_emit_legend; "cascade" (X, Y) routes through
_emit_legend_cascade_only instead, so a bare None/False
cannot suppress a different channel's legend (see that function's
docstring); on "none" legend is not honored, so nothing is
emitted -- _validate_legend_value has already refused every value
except the silent None/False.
Keys are emitted in _SPEC_DICT_ORDER so the dict layout is
stable regardless of frozenset iteration order.
to_implicit_transforms ¶
Return a list of transform objects derived from kwargs (bin, aggregate).
Both bin and aggregate transforms are returned as pending sentinels
rather than concrete Rust objects. chart.to_spec() resolves them:
_PendingBin: single-chart path converts to an unnamedBin(byte-stable); layered path converts to a namedBinfan-out so it does not corrupt the shared unnamed chain._PendingAggregate: defers groupby assignment until all sibling encoding channels are known (Altair-style auto-groupby).
option ¶
Return the value of encoding option name, or default if unset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The option key to look up (e.g. |
required |
default
|
Any
|
Value returned when name is not present. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The option value, or default when the key is absent. |
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"
|
Examples:
>>> import ferrum as fm
>>> fm.Chart(df).encode(x="x", y="y", description=fm.Description("alt_text"))
to_encoding_spec_dict ¶
Return kwargs for the Rust EncodingSpec constructor / serde JSON.
Iterates this channel's own _honored_kwargs (the single source of
truth) rather than a separate hard-coded key list, so a kwarg is
serialized iff the channel honors it. Each honored key routes through
_SPEC_DICT_HANDLERS to its serializer; keys with no handler
(bin/aggregate) are honored for the warn guard but consumed via
to_implicit_transforms, so they contribute nothing here. legend
is the one key whose serializer depends on more than its own value,
branching on _legend_surface: "own" routes through
_emit_legend; "cascade" (X, Y) routes through
_emit_legend_cascade_only instead, so a bare None/False
cannot suppress a different channel's legend (see that function's
docstring); on "none" legend is not honored, so nothing is
emitted -- _validate_legend_value has already refused every value
except the silent None/False.
Keys are emitted in _SPEC_DICT_ORDER so the dict layout is
stable regardless of frozenset iteration order.
to_implicit_transforms ¶
Return a list of transform objects derived from kwargs (bin, aggregate).
Both bin and aggregate transforms are returned as pending sentinels
rather than concrete Rust objects. chart.to_spec() resolves them:
_PendingBin: single-chart path converts to an unnamedBin(byte-stable); layered path converts to a namedBinfan-out so it does not corrupt the shared unnamed chain._PendingAggregate: defers groupby assignment until all sibling encoding channels are known (Altair-style auto-groupby).
option ¶
Return the value of encoding option name, or default if unset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The option key to look up (e.g. |
required |
default
|
Any
|
Value returned when name is not present. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The option value, or default when the key is absent. |
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"
|
Examples:
to_encoding_spec_dict ¶
Return kwargs for the Rust EncodingSpec constructor / serde JSON.
Iterates this channel's own _honored_kwargs (the single source of
truth) rather than a separate hard-coded key list, so a kwarg is
serialized iff the channel honors it. Each honored key routes through
_SPEC_DICT_HANDLERS to its serializer; keys with no handler
(bin/aggregate) are honored for the warn guard but consumed via
to_implicit_transforms, so they contribute nothing here. legend
is the one key whose serializer depends on more than its own value,
branching on _legend_surface: "own" routes through
_emit_legend; "cascade" (X, Y) routes through
_emit_legend_cascade_only instead, so a bare None/False
cannot suppress a different channel's legend (see that function's
docstring); on "none" legend is not honored, so nothing is
emitted -- _validate_legend_value has already refused every value
except the silent None/False.
Keys are emitted in _SPEC_DICT_ORDER so the dict layout is
stable regardless of frozenset iteration order.
to_implicit_transforms ¶
Return a list of transform objects derived from kwargs (bin, aggregate).
Both bin and aggregate transforms are returned as pending sentinels
rather than concrete Rust objects. chart.to_spec() resolves them:
_PendingBin: single-chart path converts to an unnamedBin(byte-stable); layered path converts to a namedBinfan-out so it does not corrupt the shared unnamed chain._PendingAggregate: defers groupby assignment until all sibling encoding channels are known (Altair-style auto-groupby).
option ¶
Return the value of encoding option name, or default if unset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The option key to look up (e.g. |
required |
default
|
Any
|
Value returned when name is not present. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The option value, or default when the key is absent. |
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; |
"Q"
|
title
|
str
|
Facet strip title. When set, the strip text renders
|
required |
columns
|
int
|
Maximum number of panels per row (wrap-count). Writes the same
sink as |
required |
sort
|
optional
|
Panel order — the same sort vocabulary the positional channels
accept: |
required |
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", facet=fm.Facet("species", columns=3)).mark_point()
>>> fm.Chart(df).encode(x="hp", y="mpg").mark_point().facet("species", ncols=3)
to_encoding_spec_dict ¶
Return kwargs for the Rust EncodingSpec constructor / serde JSON.
Iterates this channel's own _honored_kwargs (the single source of
truth) rather than a separate hard-coded key list, so a kwarg is
serialized iff the channel honors it. Each honored key routes through
_SPEC_DICT_HANDLERS to its serializer; keys with no handler
(bin/aggregate) are honored for the warn guard but consumed via
to_implicit_transforms, so they contribute nothing here. legend
is the one key whose serializer depends on more than its own value,
branching on _legend_surface: "own" routes through
_emit_legend; "cascade" (X, Y) routes through
_emit_legend_cascade_only instead, so a bare None/False
cannot suppress a different channel's legend (see that function's
docstring); on "none" legend is not honored, so nothing is
emitted -- _validate_legend_value has already refused every value
except the silent None/False.
Keys are emitted in _SPEC_DICT_ORDER so the dict layout is
stable regardless of frozenset iteration order.
to_implicit_transforms ¶
Return a list of transform objects derived from kwargs (bin, aggregate).
Both bin and aggregate transforms are returned as pending sentinels
rather than concrete Rust objects. chart.to_spec() resolves them:
_PendingBin: single-chart path converts to an unnamedBin(byte-stable); layered path converts to a namedBinfan-out so it does not corrupt the shared unnamed chain._PendingAggregate: defers groupby assignment until all sibling encoding channels are known (Altair-style auto-groupby).
option ¶
Return the value of encoding option name, or default if unset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The option key to look up (e.g. |
required |
default
|
Any
|
Value returned when name is not present. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The option value, or default when the key is absent. |
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; |
"Q"
|
title
|
str
|
Column/wrap-strip title. When set, the strip text renders
|
required |
sort
|
optional
|
Column order — same vocabulary and construction-time validation as
|
required |
Notes
columns is not honored (2026-09-23, #123): row/column faceting
has no wrap-count to apply it to, so FacetCol(field, columns=N)
raises ValueError at construction naming Facet(columns=...) for
wrap-mode panel-per-row counts instead.
Examples:
>>> import ferrum as fm
>>> fm.Chart(df).encode(x="hp", y="mpg", facet_col=fm.FacetCol("species")).mark_point()
to_encoding_spec_dict ¶
Return kwargs for the Rust EncodingSpec constructor / serde JSON.
Iterates this channel's own _honored_kwargs (the single source of
truth) rather than a separate hard-coded key list, so a kwarg is
serialized iff the channel honors it. Each honored key routes through
_SPEC_DICT_HANDLERS to its serializer; keys with no handler
(bin/aggregate) are honored for the warn guard but consumed via
to_implicit_transforms, so they contribute nothing here. legend
is the one key whose serializer depends on more than its own value,
branching on _legend_surface: "own" routes through
_emit_legend; "cascade" (X, Y) routes through
_emit_legend_cascade_only instead, so a bare None/False
cannot suppress a different channel's legend (see that function's
docstring); on "none" legend is not honored, so nothing is
emitted -- _validate_legend_value has already refused every value
except the silent None/False.
Keys are emitted in _SPEC_DICT_ORDER so the dict layout is
stable regardless of frozenset iteration order.
to_implicit_transforms ¶
Return a list of transform objects derived from kwargs (bin, aggregate).
Both bin and aggregate transforms are returned as pending sentinels
rather than concrete Rust objects. chart.to_spec() resolves them:
_PendingBin: single-chart path converts to an unnamedBin(byte-stable); layered path converts to a namedBinfan-out so it does not corrupt the shared unnamed chain._PendingAggregate: defers groupby assignment until all sibling encoding channels are known (Altair-style auto-groupby).
option ¶
Return the value of encoding option name, or default if unset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The option key to look up (e.g. |
required |
default
|
Any
|
Value returned when name is not present. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The option value, or default when the key is absent. |
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; |
"Q"
|
title
|
str
|
Row-strip title. When set, the strip text renders
|
required |
sort
|
optional
|
Row order — same vocabulary and construction-time validation as
|
required |
Notes
columns is not honored (2026-09-23, #123): row/column faceting
has no wrap-count to apply it to, so FacetRow(field, columns=N)
raises ValueError at construction naming Facet(columns=...) for
wrap-mode panel-per-row counts instead.
Examples:
>>> import ferrum as fm
>>> fm.Chart(df).encode(x="hp", y="mpg", facet_row=fm.FacetRow("year")).mark_point()
to_encoding_spec_dict ¶
Return kwargs for the Rust EncodingSpec constructor / serde JSON.
Iterates this channel's own _honored_kwargs (the single source of
truth) rather than a separate hard-coded key list, so a kwarg is
serialized iff the channel honors it. Each honored key routes through
_SPEC_DICT_HANDLERS to its serializer; keys with no handler
(bin/aggregate) are honored for the warn guard but consumed via
to_implicit_transforms, so they contribute nothing here. legend
is the one key whose serializer depends on more than its own value,
branching on _legend_surface: "own" routes through
_emit_legend; "cascade" (X, Y) routes through
_emit_legend_cascade_only instead, so a bare None/False
cannot suppress a different channel's legend (see that function's
docstring); on "none" legend is not honored, so nothing is
emitted -- _validate_legend_value has already refused every value
except the silent None/False.
Keys are emitted in _SPEC_DICT_ORDER so the dict layout is
stable regardless of frozenset iteration order.
to_implicit_transforms ¶
Return a list of transform objects derived from kwargs (bin, aggregate).
Both bin and aggregate transforms are returned as pending sentinels
rather than concrete Rust objects. chart.to_spec() resolves them:
_PendingBin: single-chart path converts to an unnamedBin(byte-stable); layered path converts to a namedBinfan-out so it does not corrupt the shared unnamed chain._PendingAggregate: defers groupby assignment until all sibling encoding channels are known (Altair-style auto-groupby).
option ¶
Return the value of encoding option name, or default if unset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The option key to look up (e.g. |
required |
default
|
Any
|
Value returned when name is not present. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The option value, or default when the key is absent. |
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, Color decides the interior of
the mark and the Fill encoding is dropped without a warning.
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"
|
scheme
|
str
|
Named categorical or continuous color scheme (e.g. |
required |
scale
|
Scale
|
Explicit scale override (e.g. |
required |
title
|
str
|
Legend title override. When omitted the field name is used. |
required |
bin
|
(bool, dict or Bin)
|
Color by bins of the numeric field: |
required |
Notes
legend is honored: passing legend={"disabled": True}, legend=None,
or legend=False suppresses the fill legend in the rendered SVG.
condition is honored: pass a ConditionalSpec built via
sel.when(...).otherwise(...) (or fm.when(sel).then(...).otherwise(...))
to switch fill based on selection state -- see Chart.encode()'s
condition= translation (ferrum-spec.md §3.10). The conditional lands
on the color channel, the same target fill aliases to for its base
encoding, so encode(fill=fm.Fill("c", condition=cond)) and
encode(fill=cond) produce the identical wire conditional.
Examples:
>>> import ferrum as fm
>>> fm.Chart(df).encode(x="hp", y="mpg", fill=fm.Fill("origin"))
>>> fm.Chart(df).encode(x="hp", y="mpg", fill=fm.Fill("origin", scheme="set1"))
to_encoding_spec_dict ¶
Return kwargs for the Rust EncodingSpec constructor / serde JSON.
Iterates this channel's own _honored_kwargs (the single source of
truth) rather than a separate hard-coded key list, so a kwarg is
serialized iff the channel honors it. Each honored key routes through
_SPEC_DICT_HANDLERS to its serializer; keys with no handler
(bin/aggregate) are honored for the warn guard but consumed via
to_implicit_transforms, so they contribute nothing here. legend
is the one key whose serializer depends on more than its own value,
branching on _legend_surface: "own" routes through
_emit_legend; "cascade" (X, Y) routes through
_emit_legend_cascade_only instead, so a bare None/False
cannot suppress a different channel's legend (see that function's
docstring); on "none" legend is not honored, so nothing is
emitted -- _validate_legend_value has already refused every value
except the silent None/False.
Keys are emitted in _SPEC_DICT_ORDER so the dict layout is
stable regardless of frozenset iteration order.
to_implicit_transforms ¶
Return a list of transform objects derived from kwargs (bin, aggregate).
Both bin and aggregate transforms are returned as pending sentinels
rather than concrete Rust objects. chart.to_spec() resolves them:
_PendingBin: single-chart path converts to an unnamedBin(byte-stable); layered path converts to a namedBinfan-out so it does not corrupt the shared unnamed chain._PendingAggregate: defers groupby assignment until all sibling encoding channels are known (Altair-style auto-groupby).
option ¶
Return the value of encoding option name, or default if unset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The option key to look up (e.g. |
required |
default
|
Any
|
Value returned when name is not present. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The option value, or default when the key is absent. |
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"
|
scale
|
LinearScale, LogScale, PowScale, SqrtScale, or dict
|
Explicit scale override: |
required |
title
|
str
|
Legend title override. When omitted the field name is used. |
required |
Notes
condition is honored: pass a ConditionalSpec built via
sel.when(...).otherwise(...) (or fm.when(sel).then(...).otherwise(...))
to switch fill opacity based on selection state -- see Chart.encode()'s
condition= translation (ferrum-spec.md §3.10).
legend is honored: a field bound to fill opacity draws a legend of
swatches at round values of the domain, each drawn at the alpha the
scale maps it to. legend=None or legend=False suppresses it and
keeps the mapped alphas; legend=Legend(title=..., format=...)
customizes it. The legend is an auxiliary block that shares the chart's
legend position, so a legend= value whose orient= is anything
other than "none" is refused.
Examples:
>>> import ferrum as fm
>>> fm.Chart(df).encode(x="hp", y="mpg", fill_opacity=fm.FillOpacity("density"))
to_encoding_spec_dict ¶
Return kwargs for the Rust EncodingSpec constructor / serde JSON.
Iterates this channel's own _honored_kwargs (the single source of
truth) rather than a separate hard-coded key list, so a kwarg is
serialized iff the channel honors it. Each honored key routes through
_SPEC_DICT_HANDLERS to its serializer; keys with no handler
(bin/aggregate) are honored for the warn guard but consumed via
to_implicit_transforms, so they contribute nothing here. legend
is the one key whose serializer depends on more than its own value,
branching on _legend_surface: "own" routes through
_emit_legend; "cascade" (X, Y) routes through
_emit_legend_cascade_only instead, so a bare None/False
cannot suppress a different channel's legend (see that function's
docstring); on "none" legend is not honored, so nothing is
emitted -- _validate_legend_value has already refused every value
except the silent None/False.
Keys are emitted in _SPEC_DICT_ORDER so the dict layout is
stable regardless of frozenset iteration order.
to_implicit_transforms ¶
Return a list of transform objects derived from kwargs (bin, aggregate).
Both bin and aggregate transforms are returned as pending sentinels
rather than concrete Rust objects. chart.to_spec() resolves them:
_PendingBin: single-chart path converts to an unnamedBin(byte-stable); layered path converts to a namedBinfan-out so it does not corrupt the shared unnamed chain._PendingAggregate: defers groupby assignment until all sibling encoding channels are known (Altair-style auto-groupby).
option ¶
Return the value of encoding option name, or default if unset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The option key to look up (e.g. |
required |
default
|
Any
|
Value returned when name is not present. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The option value, or default when the key is absent. |
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
Interactive renderers only; SVG export does not embed hyperlinks.
Examples:
to_encoding_spec_dict ¶
Return kwargs for the Rust EncodingSpec constructor / serde JSON.
Iterates this channel's own _honored_kwargs (the single source of
truth) rather than a separate hard-coded key list, so a kwarg is
serialized iff the channel honors it. Each honored key routes through
_SPEC_DICT_HANDLERS to its serializer; keys with no handler
(bin/aggregate) are honored for the warn guard but consumed via
to_implicit_transforms, so they contribute nothing here. legend
is the one key whose serializer depends on more than its own value,
branching on _legend_surface: "own" routes through
_emit_legend; "cascade" (X, Y) routes through
_emit_legend_cascade_only instead, so a bare None/False
cannot suppress a different channel's legend (see that function's
docstring); on "none" legend is not honored, so nothing is
emitted -- _validate_legend_value has already refused every value
except the silent None/False.
Keys are emitted in _SPEC_DICT_ORDER so the dict layout is
stable regardless of frozenset iteration order.
to_implicit_transforms ¶
Return a list of transform objects derived from kwargs (bin, aggregate).
Both bin and aggregate transforms are returned as pending sentinels
rather than concrete Rust objects. chart.to_spec() resolves them:
_PendingBin: single-chart path converts to an unnamedBin(byte-stable); layered path converts to a namedBinfan-out so it does not corrupt the shared unnamed chain._PendingAggregate: defers groupby assignment until all sibling encoding channels are known (Altair-style auto-groupby).
option ¶
Return the value of encoding option name, or default if unset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The option key to look up (e.g. |
required |
default
|
Any
|
Value returned when name is not present. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The option value, or default when the key is absent. |
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"
|
Examples:
to_encoding_spec_dict ¶
Return kwargs for the Rust EncodingSpec constructor / serde JSON.
Iterates this channel's own _honored_kwargs (the single source of
truth) rather than a separate hard-coded key list, so a kwarg is
serialized iff the channel honors it. Each honored key routes through
_SPEC_DICT_HANDLERS to its serializer; keys with no handler
(bin/aggregate) are honored for the warn guard but consumed via
to_implicit_transforms, so they contribute nothing here. legend
is the one key whose serializer depends on more than its own value,
branching on _legend_surface: "own" routes through
_emit_legend; "cascade" (X, Y) routes through
_emit_legend_cascade_only instead, so a bare None/False
cannot suppress a different channel's legend (see that function's
docstring); on "none" legend is not honored, so nothing is
emitted -- _validate_legend_value has already refused every value
except the silent None/False.
Keys are emitted in _SPEC_DICT_ORDER so the dict layout is
stable regardless of frozenset iteration order.
to_implicit_transforms ¶
Return a list of transform objects derived from kwargs (bin, aggregate).
Both bin and aggregate transforms are returned as pending sentinels
rather than concrete Rust objects. chart.to_spec() resolves them:
_PendingBin: single-chart path converts to an unnamedBin(byte-stable); layered path converts to a namedBinfan-out so it does not corrupt the shared unnamed chain._PendingAggregate: defers groupby assignment until all sibling encoding channels are known (Altair-style auto-groupby).
option ¶
Return the value of encoding option name, or default if unset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The option key to look up (e.g. |
required |
default
|
Any
|
Value returned when name is not present. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The option value, or default when the key is absent. |
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
|
LinearScale, LogScale, PowScale, SqrtScale, or dict
|
Explicit scale override: |
required |
title
|
str
|
Legend title override. When omitted the field name is used. |
required |
Notes
condition is honored: pass a ConditionalSpec built via
sel.when(...).otherwise(...) (or fm.when(sel).then(...).otherwise(...))
to switch opacity based on selection state -- see Chart.encode()'s
condition= translation (ferrum-spec.md §3.10).
legend is honored: a field bound to opacity draws a legend of
swatches at round values of the domain, each drawn at the alpha the
scale maps it to. legend=None or legend=False suppresses it and
keeps the mapped alphas; legend=Legend(title=..., format=...)
customizes it. The legend is an auxiliary block that shares the chart's
legend position, so a legend= value whose orient= is anything
other than "none" is refused.
Examples:
to_encoding_spec_dict ¶
Return kwargs for the Rust EncodingSpec constructor / serde JSON.
Iterates this channel's own _honored_kwargs (the single source of
truth) rather than a separate hard-coded key list, so a kwarg is
serialized iff the channel honors it. Each honored key routes through
_SPEC_DICT_HANDLERS to its serializer; keys with no handler
(bin/aggregate) are honored for the warn guard but consumed via
to_implicit_transforms, so they contribute nothing here. legend
is the one key whose serializer depends on more than its own value,
branching on _legend_surface: "own" routes through
_emit_legend; "cascade" (X, Y) routes through
_emit_legend_cascade_only instead, so a bare None/False
cannot suppress a different channel's legend (see that function's
docstring); on "none" legend is not honored, so nothing is
emitted -- _validate_legend_value has already refused every value
except the silent None/False.
Keys are emitted in _SPEC_DICT_ORDER so the dict layout is
stable regardless of frozenset iteration order.
to_implicit_transforms ¶
Return a list of transform objects derived from kwargs (bin, aggregate).
Both bin and aggregate transforms are returned as pending sentinels
rather than concrete Rust objects. chart.to_spec() resolves them:
_PendingBin: single-chart path converts to an unnamedBin(byte-stable); layered path converts to a namedBinfan-out so it does not corrupt the shared unnamed chain._PendingAggregate: defers groupby assignment until all sibling encoding channels are known (Altair-style auto-groupby).
option ¶
Return the value of encoding option name, or default if unset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The option key to look up (e.g. |
required |
default
|
Any
|
Value returned when name is not present. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The option value, or default when the key is absent. |
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"
|
stack
|
bool or str
|
Stacking behaviour for radial bars (wind-rose / coxcomb charts).
|
required |
aggregate
|
str
|
Aggregation operation applied before mapping (e.g. |
required |
Notes
Requires CoordPolar() on the chart to activate polar rendering;
without it the channel is registered but the mark renders in Cartesian
space.
When stack is set, the radius channel is remapped to y (the value
axis) before reaching Rust's apply_stack; bar.rs build_polar then
reads __stack_y_base__ as the inner radius so each segment starts
where the previous one ended. Pass position=fm.Stack() on
mark_bar() as an alternative.
Examples:
>>> import ferrum as fm
>>> fm.Chart(df).encode(theta=fm.Theta("count"), radius=fm.Radius("distance"))
>>> # Stacked wind-rose / coxcomb:
>>> fm.Chart(df).encode(
... theta=fm.Theta("direction"),
... radius=fm.Radius("speed", stack=True),
... color="category:N",
... ).coord(fm.CoordPolar(theta="x"))
to_encoding_spec_dict ¶
Return kwargs for the Rust EncodingSpec constructor / serde JSON.
Iterates this channel's own _honored_kwargs (the single source of
truth) rather than a separate hard-coded key list, so a kwarg is
serialized iff the channel honors it. Each honored key routes through
_SPEC_DICT_HANDLERS to its serializer; keys with no handler
(bin/aggregate) are honored for the warn guard but consumed via
to_implicit_transforms, so they contribute nothing here. legend
is the one key whose serializer depends on more than its own value,
branching on _legend_surface: "own" routes through
_emit_legend; "cascade" (X, Y) routes through
_emit_legend_cascade_only instead, so a bare None/False
cannot suppress a different channel's legend (see that function's
docstring); on "none" legend is not honored, so nothing is
emitted -- _validate_legend_value has already refused every value
except the silent None/False.
Keys are emitted in _SPEC_DICT_ORDER so the dict layout is
stable regardless of frozenset iteration order.
to_implicit_transforms ¶
Return a list of transform objects derived from kwargs (bin, aggregate).
Both bin and aggregate transforms are returned as pending sentinels
rather than concrete Rust objects. chart.to_spec() resolves them:
_PendingBin: single-chart path converts to an unnamedBin(byte-stable); layered path converts to a namedBinfan-out so it does not corrupt the shared unnamed chain._PendingAggregate: defers groupby assignment until all sibling encoding channels are known (Altair-style auto-groupby).
option ¶
Return the value of encoding option name, or default if unset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The option key to look up (e.g. |
required |
default
|
Any
|
Value returned when name is not present. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The option value, or default when the key is absent. |
Radius2 ¶
Bases: ChannelBase
Polar second-extent radius channel — maps a field to the outer radial boundary.
Used with Radius to define an explicit inner/outer radial span for each
arc segment (annular wedge marks). When both radius and radius2 are
encoded, the arc spans from the radius column value (inner boundary) to
the radius2 column value (outer boundary) per row.
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"
|
aggregate
|
str
|
Aggregation operation applied before mapping (e.g. |
required |
Notes
Requires CoordPolar() on the chart to activate polar rendering.
Remapped to y2 (when CoordPolar(theta="x")) or x2
(when CoordPolar(theta="y")) before the spec reaches Rust.
Examples:
>>> import ferrum as fm
>>> fm.Chart(df).encode(
... theta=fm.Theta("t_start"),
... theta2=fm.Theta2("t_end"),
... radius=fm.Radius("r_inner"),
... radius2=fm.Radius2("r_outer"),
... )
to_encoding_spec_dict ¶
Return kwargs for the Rust EncodingSpec constructor / serde JSON.
Iterates this channel's own _honored_kwargs (the single source of
truth) rather than a separate hard-coded key list, so a kwarg is
serialized iff the channel honors it. Each honored key routes through
_SPEC_DICT_HANDLERS to its serializer; keys with no handler
(bin/aggregate) are honored for the warn guard but consumed via
to_implicit_transforms, so they contribute nothing here. legend
is the one key whose serializer depends on more than its own value,
branching on _legend_surface: "own" routes through
_emit_legend; "cascade" (X, Y) routes through
_emit_legend_cascade_only instead, so a bare None/False
cannot suppress a different channel's legend (see that function's
docstring); on "none" legend is not honored, so nothing is
emitted -- _validate_legend_value has already refused every value
except the silent None/False.
Keys are emitted in _SPEC_DICT_ORDER so the dict layout is
stable regardless of frozenset iteration order.
to_implicit_transforms ¶
Return a list of transform objects derived from kwargs (bin, aggregate).
Both bin and aggregate transforms are returned as pending sentinels
rather than concrete Rust objects. chart.to_spec() resolves them:
_PendingBin: single-chart path converts to an unnamedBin(byte-stable); layered path converts to a namedBinfan-out so it does not corrupt the shared unnamed chain._PendingAggregate: defers groupby assignment until all sibling encoding channels are known (Altair-style auto-groupby).
option ¶
Return the value of encoding option name, or default if unset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The option key to look up (e.g. |
required |
default
|
Any
|
Value returned when name is not present. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The option value, or default when the key is absent. |
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; |
"Q"
|
scale
|
Scale
|
Explicit scale override. |
required |
title
|
str
|
Legend title override. |
required |
Notes
legend is honored: passing legend=None or legend=False suppresses
the shape legend in the rendered SVG. legend=Legend(title=..., format=...)
customizes the legend title. When legend is omitted, a categorical shape
legend is rendered automatically showing one glyph per distinct category value.
A legend= value whose orient= is anything other than "none" is
refused (2026-09-23, #123): Shape's legend is an auxiliary block that
always shares the chart's legend position -- place it with
Color(legend=Legend(orient=...)) or configure_legend(orient=...).
sort is honored: pass "ascending", "descending", a list of strings
for an explicit domain order, or a channel shorthand such as "-y" to sort
by the per-category aggregate of another channel.
condition is not honored: shape is not a conditional target,
and encode(shape=<ConditionalSpec>) / Shape(field, condition=...)
raise ValueError at encode() time naming the channels that are.
The wire has a shape channel name but no shape value: a shape
conditional could only carry a field reference, which the runtime applies
as a no-op, so it would serialize cleanly and then do nothing. An earlier
version of this docstring said condition was honored, written on the
assumption that reaching the wire meant working; it did not. Refusing
beats a kwarg that quietly does nothing. Filed follow-up:
EncodingValue::Shape in Rust, after which this channel can honor
condition for real.
Examples:
>>> import ferrum as fm
>>> fm.Chart(df).encode(x="hp", y="mpg", shape=fm.Shape("origin", type_="N"))
>>> fm.Chart(df).encode(x="hp", y="mpg", shape=fm.Shape("origin", sort="descending"))
>>> fm.Chart(df).encode(x="hp", y="mpg", shape=fm.Shape("origin", legend=None))
to_encoding_spec_dict ¶
Return kwargs for the Rust EncodingSpec constructor / serde JSON.
Iterates this channel's own _honored_kwargs (the single source of
truth) rather than a separate hard-coded key list, so a kwarg is
serialized iff the channel honors it. Each honored key routes through
_SPEC_DICT_HANDLERS to its serializer; keys with no handler
(bin/aggregate) are honored for the warn guard but consumed via
to_implicit_transforms, so they contribute nothing here. legend
is the one key whose serializer depends on more than its own value,
branching on _legend_surface: "own" routes through
_emit_legend; "cascade" (X, Y) routes through
_emit_legend_cascade_only instead, so a bare None/False
cannot suppress a different channel's legend (see that function's
docstring); on "none" legend is not honored, so nothing is
emitted -- _validate_legend_value has already refused every value
except the silent None/False.
Keys are emitted in _SPEC_DICT_ORDER so the dict layout is
stable regardless of frozenset iteration order.
to_implicit_transforms ¶
Return a list of transform objects derived from kwargs (bin, aggregate).
Both bin and aggregate transforms are returned as pending sentinels
rather than concrete Rust objects. chart.to_spec() resolves them:
_PendingBin: single-chart path converts to an unnamedBin(byte-stable); layered path converts to a namedBinfan-out so it does not corrupt the shared unnamed chain._PendingAggregate: defers groupby assignment until all sibling encoding channels are known (Altair-style auto-groupby).
option ¶
Return the value of encoding option name, or default if unset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The option key to look up (e.g. |
required |
default
|
Any
|
Value returned when name is not present. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The option value, or default when the key is absent. |
Size ¶
Bases: ChannelBase
Size channel — maps a field to a point's area or a line's width.
The size scale maps each value to an area in square pixels. A point mark
draws that area. A line mark draws the diameter of a dot with that area,
2 * sqrt(area / pi) pixels, at each vertex, so the line tapers along
its length and a line and a point sharing one size encoding agree: the
line is as wide as the dot drawn for the same value. A line that binds
size cannot also bind stroke_width; rendering such a line raises
ValueError.
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
|
LinearScale, LogScale, PowScale, SqrtScale, or dict
|
Explicit scale override. Its |
required |
title
|
str
|
Legend title override. |
required |
Notes
legend is honored: passing legend=None or legend=False suppresses
the size legend in the rendered SVG. legend=Legend(title=..., format=...)
customizes the legend title and numeric format string. When legend is
omitted, a graduated size legend is rendered automatically showing ~5 round
representative values from the field's domain. condition is honored:
pass a ConditionalSpec built via sel.when(...).otherwise(...) (or
fm.when(sel).then(...).otherwise(...)) to switch size based on
selection state -- see Chart.encode()'s condition= translation
(ferrum-spec.md §3.10). On a line, a conditional size draws the base
width in static output; in the interactive view each vertex redraws at
the dot-diameter width of its row's active branch. Every branch must be
positive on such a line, and a conditional size plus stroke_width
raises ValueError as any other size does.
A field size and a conditional size follow one rule under
chart + chart: each reaches only the layers of the chart it was
declared on. point.encode(size="v") + line sizes the points and
leaves the line untapered, and a point beside a line that declared one
is not resized by it; the panel still draws one size scale and legend
over every layer that draws size. To size both, declare it on the
composition: (point + line).encode(size="v"). A size declared on a
layered chart as a whole, on a composite such as
mark_line(point=True), or on the host of Chart.layer() reaches
every layer of that chart that binds none, lines included; one declared
on a Layer's own encoding reaches that layer only.
When size and color are both mapped to the same field, ferrum merges
them into a single combined legend block.
Examples:
>>> import ferrum as fm
>>> fm.Chart(df).encode(x="hp", y="mpg", size=fm.Size("weight"))
>>> fm.Chart(df).encode(x="hp", y="mpg", size=fm.Size("pop", legend=None))
>>> fm.Chart(df).mark_line().encode(x="year", y="price", size=fm.Size("volume"))
to_encoding_spec_dict ¶
Return kwargs for the Rust EncodingSpec constructor / serde JSON.
Iterates this channel's own _honored_kwargs (the single source of
truth) rather than a separate hard-coded key list, so a kwarg is
serialized iff the channel honors it. Each honored key routes through
_SPEC_DICT_HANDLERS to its serializer; keys with no handler
(bin/aggregate) are honored for the warn guard but consumed via
to_implicit_transforms, so they contribute nothing here. legend
is the one key whose serializer depends on more than its own value,
branching on _legend_surface: "own" routes through
_emit_legend; "cascade" (X, Y) routes through
_emit_legend_cascade_only instead, so a bare None/False
cannot suppress a different channel's legend (see that function's
docstring); on "none" legend is not honored, so nothing is
emitted -- _validate_legend_value has already refused every value
except the silent None/False.
Keys are emitted in _SPEC_DICT_ORDER so the dict layout is
stable regardless of frozenset iteration order.
to_implicit_transforms ¶
Return a list of transform objects derived from kwargs (bin, aggregate).
Both bin and aggregate transforms are returned as pending sentinels
rather than concrete Rust objects. chart.to_spec() resolves them:
_PendingBin: single-chart path converts to an unnamedBin(byte-stable); layered path converts to a namedBinfan-out so it does not corrupt the shared unnamed chain._PendingAggregate: defers groupby assignment until all sibling encoding channels are known (Altair-style auto-groupby).
option ¶
Return the value of encoding option name, or default if unset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The option key to look up (e.g. |
required |
default
|
Any
|
Value returned when name is not present. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The option value, or default when the key is absent. |
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"
|
scheme
|
str
|
Named categorical or continuous color scheme (e.g. |
required |
scale
|
Scale
|
Explicit scale override (e.g. |
required |
title
|
str
|
Legend title override. When omitted the field name is used. |
required |
bin
|
(bool, dict or Bin)
|
Color by bins of the numeric field: |
required |
Notes
legend is honored: passing legend={"disabled": True}, legend=None,
or legend=False suppresses the stroke legend in the rendered SVG.
condition is not honored: stroke is not a conditional target,
and encode(stroke=<ConditionalSpec>) / Stroke(field, condition=...)
raise ValueError at encode() time naming the channels that are.
The reason is a missing renderer capability rather than a policy choice:
a conditional's only colour value is EncodingValue::Color, which the
WASM runtime applies to the mark's fill (apply_value_common;
FillStrokeView has no stroke-colour member), so carrying a stroke
conditional onto color -- the channel stroke aliases to for its
base encoding -- would recolour the interior instead of the outline.
Refusing beats silently changing the wrong property. Fill is
unaffected and does honor condition (Color is the fill).
Filed follow-up: EncodingValue::StrokeColor in Rust, after which this
channel can honor condition for real.
Examples:
>>> import ferrum as fm
>>> fm.Chart(df).encode(x="hp", y="mpg", stroke=fm.Stroke("origin"))
>>> fm.Chart(df).encode(x="hp", y="mpg", stroke=fm.Stroke("origin", scheme="set1"))
to_encoding_spec_dict ¶
Return kwargs for the Rust EncodingSpec constructor / serde JSON.
Iterates this channel's own _honored_kwargs (the single source of
truth) rather than a separate hard-coded key list, so a kwarg is
serialized iff the channel honors it. Each honored key routes through
_SPEC_DICT_HANDLERS to its serializer; keys with no handler
(bin/aggregate) are honored for the warn guard but consumed via
to_implicit_transforms, so they contribute nothing here. legend
is the one key whose serializer depends on more than its own value,
branching on _legend_surface: "own" routes through
_emit_legend; "cascade" (X, Y) routes through
_emit_legend_cascade_only instead, so a bare None/False
cannot suppress a different channel's legend (see that function's
docstring); on "none" legend is not honored, so nothing is
emitted -- _validate_legend_value has already refused every value
except the silent None/False.
Keys are emitted in _SPEC_DICT_ORDER so the dict layout is
stable regardless of frozenset iteration order.
to_implicit_transforms ¶
Return a list of transform objects derived from kwargs (bin, aggregate).
Both bin and aggregate transforms are returned as pending sentinels
rather than concrete Rust objects. chart.to_spec() resolves them:
_PendingBin: single-chart path converts to an unnamedBin(byte-stable); layered path converts to a namedBinfan-out so it does not corrupt the shared unnamed chain._PendingAggregate: defers groupby assignment until all sibling encoding channels are known (Altair-style auto-groupby).
option ¶
Return the value of encoding option name, or default if unset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The option key to look up (e.g. |
required |
default
|
Any
|
Value returned when name is not present. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The option value, or default when the key is absent. |
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"
|
scale
|
Scale
|
Explicit scale override. |
required |
title
|
str
|
Legend title override. |
required |
Notes
legend is honored: passing legend=None or legend=False suppresses
the legend in the rendered SVG. scale (explicit scale override, domain
only -- see above) and title (legend title) are also honored. A
legend= value whose orient= is anything other than "none" is
refused (2026-09-23, #123): StrokeDash's legend is an auxiliary block
that always shares the chart's legend position -- place it with
Color(legend=Legend(orient=...)) or configure_legend(orient=...).
sort is honored: pass
"ascending", "descending", a list of strings for an explicit domain
order, or a channel shorthand such as "-y" to sort by the per-category
aggregate of another channel — mirroring Shape, since the Rust
build_stroke_dash_scale domain builder already reads it. condition
is honored: pass a ConditionalSpec built via sel.when(...).otherwise(...)
(or fm.when(sel).then(...).otherwise(...)) to switch stroke dash based
on selection state -- see Chart.encode()'s condition= translation
(ferrum-spec.md §3.10).
Examples:
>>> import ferrum as fm
>>> fm.Chart(df).encode(x="x", y="y", stroke_dash=fm.StrokeDash("group", type_="N"))
>>> fm.Chart(df).encode(x="x", y="y", stroke_dash=fm.StrokeDash("group", sort="descending"))
to_encoding_spec_dict ¶
Return kwargs for the Rust EncodingSpec constructor / serde JSON.
Iterates this channel's own _honored_kwargs (the single source of
truth) rather than a separate hard-coded key list, so a kwarg is
serialized iff the channel honors it. Each honored key routes through
_SPEC_DICT_HANDLERS to its serializer; keys with no handler
(bin/aggregate) are honored for the warn guard but consumed via
to_implicit_transforms, so they contribute nothing here. legend
is the one key whose serializer depends on more than its own value,
branching on _legend_surface: "own" routes through
_emit_legend; "cascade" (X, Y) routes through
_emit_legend_cascade_only instead, so a bare None/False
cannot suppress a different channel's legend (see that function's
docstring); on "none" legend is not honored, so nothing is
emitted -- _validate_legend_value has already refused every value
except the silent None/False.
Keys are emitted in _SPEC_DICT_ORDER so the dict layout is
stable regardless of frozenset iteration order.
to_implicit_transforms ¶
Return a list of transform objects derived from kwargs (bin, aggregate).
Both bin and aggregate transforms are returned as pending sentinels
rather than concrete Rust objects. chart.to_spec() resolves them:
_PendingBin: single-chart path converts to an unnamedBin(byte-stable); layered path converts to a namedBinfan-out so it does not corrupt the shared unnamed chain._PendingAggregate: defers groupby assignment until all sibling encoding channels are known (Altair-style auto-groupby).
option ¶
Return the value of encoding option name, or default if unset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The option key to look up (e.g. |
required |
default
|
Any
|
Value returned when name is not present. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The option value, or default when the key is absent. |
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"
|
scale
|
LinearScale, LogScale, PowScale, SqrtScale, or dict
|
Explicit scale override: |
required |
title
|
str
|
Legend title override. When omitted the field name is used. |
required |
Notes
condition is honored: pass a ConditionalSpec built via
sel.when(...).otherwise(...) (or fm.when(sel).then(...).otherwise(...))
to switch stroke opacity based on selection state -- see Chart.encode()'s
condition= translation (ferrum-spec.md §3.10).
legend is honored: a field bound to stroke opacity draws a legend of
swatches at round values of the domain, each drawn at the alpha the
scale maps it to. legend=None or legend=False suppresses it and
keeps the mapped alphas; legend=Legend(title=..., format=...)
customizes it. The legend is an auxiliary block that shares the chart's
legend position, so a legend= value whose orient= is anything
other than "none" is refused.
Examples:
>>> import ferrum as fm
>>> fm.Chart(df).encode(x="hp", y="mpg", stroke_opacity=fm.StrokeOpacity("year"))
to_encoding_spec_dict ¶
Return kwargs for the Rust EncodingSpec constructor / serde JSON.
Iterates this channel's own _honored_kwargs (the single source of
truth) rather than a separate hard-coded key list, so a kwarg is
serialized iff the channel honors it. Each honored key routes through
_SPEC_DICT_HANDLERS to its serializer; keys with no handler
(bin/aggregate) are honored for the warn guard but consumed via
to_implicit_transforms, so they contribute nothing here. legend
is the one key whose serializer depends on more than its own value,
branching on _legend_surface: "own" routes through
_emit_legend; "cascade" (X, Y) routes through
_emit_legend_cascade_only instead, so a bare None/False
cannot suppress a different channel's legend (see that function's
docstring); on "none" legend is not honored, so nothing is
emitted -- _validate_legend_value has already refused every value
except the silent None/False.
Keys are emitted in _SPEC_DICT_ORDER so the dict layout is
stable regardless of frozenset iteration order.
to_implicit_transforms ¶
Return a list of transform objects derived from kwargs (bin, aggregate).
Both bin and aggregate transforms are returned as pending sentinels
rather than concrete Rust objects. chart.to_spec() resolves them:
_PendingBin: single-chart path converts to an unnamedBin(byte-stable); layered path converts to a namedBinfan-out so it does not corrupt the shared unnamed chain._PendingAggregate: defers groupby assignment until all sibling encoding channels are known (Altair-style auto-groupby).
option ¶
Return the value of encoding option name, or default if unset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The option key to look up (e.g. |
required |
default
|
Any
|
Value returned when name is not present. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The option value, or default when the key is absent. |
StrokeWidth ¶
Bases: ChannelBase
Stroke-width channel — maps a field to stroke width in pixels.
A linear scale maps the field's extent onto a 1 to 4 pixel band, so
larger values draw thicker strokes; values outside an explicit domain
draw at the nearer end of the range, and a null value draws the mark's
default width. To draw a column of literal pixel widths, pass a scale
whose domain equals its range, e.g.
StrokeWidth("w", scale=fm.LinearScale(domain=[1, 6], range=[1, 6])).
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"
|
scale
|
LinearScale, LogScale, PowScale, SqrtScale, or dict
|
Explicit scale override: |
required |
title
|
str
|
Legend title override. When omitted the field name is used. |
required |
Notes
condition is honored: pass a ConditionalSpec built via
sel.when(...).otherwise(...) (or fm.when(sel).then(...).otherwise(...))
to switch stroke width based on selection state -- see Chart.encode()'s
condition= translation (ferrum-spec.md §3.10).
legend is honored: a field bound to stroke width draws a legend of
line swatches at round values of the domain, each drawn at the width
the scale maps it to. legend=None or legend=False suppresses it
and keeps the mapped widths; legend=Legend(title=..., format=...)
customizes it. The legend is an auxiliary block that shares the chart's
legend position, so a legend= value whose orient= is anything
other than "none" is refused.
Examples:
>>> import ferrum as fm
>>> fm.Chart(df).encode(x="x", y="y", stroke_width=fm.StrokeWidth("importance"))
to_encoding_spec_dict ¶
Return kwargs for the Rust EncodingSpec constructor / serde JSON.
Iterates this channel's own _honored_kwargs (the single source of
truth) rather than a separate hard-coded key list, so a kwarg is
serialized iff the channel honors it. Each honored key routes through
_SPEC_DICT_HANDLERS to its serializer; keys with no handler
(bin/aggregate) are honored for the warn guard but consumed via
to_implicit_transforms, so they contribute nothing here. legend
is the one key whose serializer depends on more than its own value,
branching on _legend_surface: "own" routes through
_emit_legend; "cascade" (X, Y) routes through
_emit_legend_cascade_only instead, so a bare None/False
cannot suppress a different channel's legend (see that function's
docstring); on "none" legend is not honored, so nothing is
emitted -- _validate_legend_value has already refused every value
except the silent None/False.
Keys are emitted in _SPEC_DICT_ORDER so the dict layout is
stable regardless of frozenset iteration order.
to_implicit_transforms ¶
Return a list of transform objects derived from kwargs (bin, aggregate).
Both bin and aggregate transforms are returned as pending sentinels
rather than concrete Rust objects. chart.to_spec() resolves them:
_PendingBin: single-chart path converts to an unnamedBin(byte-stable); layered path converts to a namedBinfan-out so it does not corrupt the shared unnamed chain._PendingAggregate: defers groupby assignment until all sibling encoding channels are known (Altair-style auto-groupby).
option ¶
Return the value of encoding option name, or default if unset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The option key to look up (e.g. |
required |
default
|
Any
|
Value returned when name is not present. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The option value, or default when the key is absent. |
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. |
required |
format_type
|
str
|
Format type hint; |
required |
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 ¶
Return kwargs for the Rust EncodingSpec constructor / serde JSON.
Iterates this channel's own _honored_kwargs (the single source of
truth) rather than a separate hard-coded key list, so a kwarg is
serialized iff the channel honors it. Each honored key routes through
_SPEC_DICT_HANDLERS to its serializer; keys with no handler
(bin/aggregate) are honored for the warn guard but consumed via
to_implicit_transforms, so they contribute nothing here. legend
is the one key whose serializer depends on more than its own value,
branching on _legend_surface: "own" routes through
_emit_legend; "cascade" (X, Y) routes through
_emit_legend_cascade_only instead, so a bare None/False
cannot suppress a different channel's legend (see that function's
docstring); on "none" legend is not honored, so nothing is
emitted -- _validate_legend_value has already refused every value
except the silent None/False.
Keys are emitted in _SPEC_DICT_ORDER so the dict layout is
stable regardless of frozenset iteration order.
to_implicit_transforms ¶
Return a list of transform objects derived from kwargs (bin, aggregate).
Both bin and aggregate transforms are returned as pending sentinels
rather than concrete Rust objects. chart.to_spec() resolves them:
_PendingBin: single-chart path converts to an unnamedBin(byte-stable); layered path converts to a namedBinfan-out so it does not corrupt the shared unnamed chain._PendingAggregate: defers groupby assignment until all sibling encoding channels are known (Altair-style auto-groupby).
option ¶
Return the value of encoding option name, or default if unset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The option key to look up (e.g. |
required |
default
|
Any
|
Value returned when name is not present. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The option value, or default when the key is absent. |
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. |
required |
aggregate
|
str
|
Aggregation operation applied before mapping (e.g. |
required |
Notes
Requires CoordPolar() on the chart to activate polar rendering;
without it the channel is registered but the mark renders in Cartesian
space.
Examples:
to_encoding_spec_dict ¶
Return kwargs for the Rust EncodingSpec constructor / serde JSON.
Iterates this channel's own _honored_kwargs (the single source of
truth) rather than a separate hard-coded key list, so a kwarg is
serialized iff the channel honors it. Each honored key routes through
_SPEC_DICT_HANDLERS to its serializer; keys with no handler
(bin/aggregate) are honored for the warn guard but consumed via
to_implicit_transforms, so they contribute nothing here. legend
is the one key whose serializer depends on more than its own value,
branching on _legend_surface: "own" routes through
_emit_legend; "cascade" (X, Y) routes through
_emit_legend_cascade_only instead, so a bare None/False
cannot suppress a different channel's legend (see that function's
docstring); on "none" legend is not honored, so nothing is
emitted -- _validate_legend_value has already refused every value
except the silent None/False.
Keys are emitted in _SPEC_DICT_ORDER so the dict layout is
stable regardless of frozenset iteration order.
to_implicit_transforms ¶
Return a list of transform objects derived from kwargs (bin, aggregate).
Both bin and aggregate transforms are returned as pending sentinels
rather than concrete Rust objects. chart.to_spec() resolves them:
_PendingBin: single-chart path converts to an unnamedBin(byte-stable); layered path converts to a namedBinfan-out so it does not corrupt the shared unnamed chain._PendingAggregate: defers groupby assignment until all sibling encoding channels are known (Altair-style auto-groupby).
option ¶
Return the value of encoding option name, or default if unset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The option key to look up (e.g. |
required |
default
|
Any
|
Value returned when name is not present. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The option value, or default when the key is absent. |
Theta2 ¶
Bases: ChannelBase
Polar second-extent angle channel — maps a field to the angular end position.
Used with Theta to define an explicit angular span for each arc segment
(annular wedge marks). When both theta and theta2 are encoded, the
arc sweeps from the theta value to the theta2 value directly from
data, rather than computing a proportional sweep from column sums.
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"
|
aggregate
|
str
|
Aggregation operation applied before mapping (e.g. |
required |
Notes
Requires CoordPolar() on the chart to activate polar rendering.
Remapped to x2 (when CoordPolar(theta="x")) or y2
(when CoordPolar(theta="y")) before the spec reaches Rust.
Examples:
>>> import ferrum as fm
>>> fm.Chart(df).encode(
... theta=fm.Theta("t_start"),
... theta2=fm.Theta2("t_end"),
... radius=fm.Radius("r_inner"),
... radius2=fm.Radius2("r_outer"),
... )
to_encoding_spec_dict ¶
Return kwargs for the Rust EncodingSpec constructor / serde JSON.
Iterates this channel's own _honored_kwargs (the single source of
truth) rather than a separate hard-coded key list, so a kwarg is
serialized iff the channel honors it. Each honored key routes through
_SPEC_DICT_HANDLERS to its serializer; keys with no handler
(bin/aggregate) are honored for the warn guard but consumed via
to_implicit_transforms, so they contribute nothing here. legend
is the one key whose serializer depends on more than its own value,
branching on _legend_surface: "own" routes through
_emit_legend; "cascade" (X, Y) routes through
_emit_legend_cascade_only instead, so a bare None/False
cannot suppress a different channel's legend (see that function's
docstring); on "none" legend is not honored, so nothing is
emitted -- _validate_legend_value has already refused every value
except the silent None/False.
Keys are emitted in _SPEC_DICT_ORDER so the dict layout is
stable regardless of frozenset iteration order.
to_implicit_transforms ¶
Return a list of transform objects derived from kwargs (bin, aggregate).
Both bin and aggregate transforms are returned as pending sentinels
rather than concrete Rust objects. chart.to_spec() resolves them:
_PendingBin: single-chart path converts to an unnamedBin(byte-stable); layered path converts to a namedBinfan-out so it does not corrupt the shared unnamed chain._PendingAggregate: defers groupby assignment until all sibling encoding channels are known (Altair-style auto-groupby).
option ¶
Return the value of encoding option name, or default if unset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The option key to look up (e.g. |
required |
default
|
Any
|
Value returned when name is not present. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The option value, or default when the key is absent. |
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 |
()
|
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 ¶
Return kwargs for the Rust EncodingSpec constructor / serde JSON.
Iterates this channel's own _honored_kwargs (the single source of
truth) rather than a separate hard-coded key list, so a kwarg is
serialized iff the channel honors it. Each honored key routes through
_SPEC_DICT_HANDLERS to its serializer; keys with no handler
(bin/aggregate) are honored for the warn guard but consumed via
to_implicit_transforms, so they contribute nothing here. legend
is the one key whose serializer depends on more than its own value,
branching on _legend_surface: "own" routes through
_emit_legend; "cascade" (X, Y) routes through
_emit_legend_cascade_only instead, so a bare None/False
cannot suppress a different channel's legend (see that function's
docstring); on "none" legend is not honored, so nothing is
emitted -- _validate_legend_value has already refused every value
except the silent None/False.
Keys are emitted in _SPEC_DICT_ORDER so the dict layout is
stable regardless of frozenset iteration order.
to_implicit_transforms ¶
Return a list of transform objects derived from kwargs (bin, aggregate).
Both bin and aggregate transforms are returned as pending sentinels
rather than concrete Rust objects. chart.to_spec() resolves them:
_PendingBin: single-chart path converts to an unnamedBin(byte-stable); layered path converts to a namedBinfan-out so it does not corrupt the shared unnamed chain._PendingAggregate: defers groupby assignment until all sibling encoding channels are known (Altair-style auto-groupby).
option ¶
Return the value of encoding option name, or default if unset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The option key to look up (e.g. |
required |
default
|
Any
|
Value returned when name is not present. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The option value, or default when the key is absent. |
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. |
required |
format_type
|
str
|
Format type hint; |
required |
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 ¶
Return kwargs for the Rust EncodingSpec constructor / serde JSON.
Iterates this channel's own _honored_kwargs (the single source of
truth) rather than a separate hard-coded key list, so a kwarg is
serialized iff the channel honors it. Each honored key routes through
_SPEC_DICT_HANDLERS to its serializer; keys with no handler
(bin/aggregate) are honored for the warn guard but consumed via
to_implicit_transforms, so they contribute nothing here. legend
is the one key whose serializer depends on more than its own value,
branching on _legend_surface: "own" routes through
_emit_legend; "cascade" (X, Y) routes through
_emit_legend_cascade_only instead, so a bare None/False
cannot suppress a different channel's legend (see that function's
docstring); on "none" legend is not honored, so nothing is
emitted -- _validate_legend_value has already refused every value
except the silent None/False.
Keys are emitted in _SPEC_DICT_ORDER so the dict layout is
stable regardless of frozenset iteration order.
to_implicit_transforms ¶
Return a list of transform objects derived from kwargs (bin, aggregate).
Both bin and aggregate transforms are returned as pending sentinels
rather than concrete Rust objects. chart.to_spec() resolves them:
_PendingBin: single-chart path converts to an unnamedBin(byte-stable); layered path converts to a namedBinfan-out so it does not corrupt the shared unnamed chain._PendingAggregate: defers groupby assignment until all sibling encoding channels are known (Altair-style auto-groupby).
option ¶
Return the value of encoding option name, or default if unset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The option key to look up (e.g. |
required |
default
|
Any
|
Value returned when name is not present. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The option value, or default when the key is absent. |
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 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
|
"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 ¶
Return kwargs for the Rust EncodingSpec constructor / serde JSON.
Iterates this channel's own _honored_kwargs (the single source of
truth) rather than a separate hard-coded key list, so a kwarg is
serialized iff the channel honors it. Each honored key routes through
_SPEC_DICT_HANDLERS to its serializer; keys with no handler
(bin/aggregate) are honored for the warn guard but consumed via
to_implicit_transforms, so they contribute nothing here. legend
is the one key whose serializer depends on more than its own value,
branching on _legend_surface: "own" routes through
_emit_legend; "cascade" (X, Y) routes through
_emit_legend_cascade_only instead, so a bare None/False
cannot suppress a different channel's legend (see that function's
docstring); on "none" legend is not honored, so nothing is
emitted -- _validate_legend_value has already refused every value
except the silent None/False.
Keys are emitted in _SPEC_DICT_ORDER so the dict layout is
stable regardless of frozenset iteration order.
to_implicit_transforms ¶
Return a list of transform objects derived from kwargs (bin, aggregate).
Both bin and aggregate transforms are returned as pending sentinels
rather than concrete Rust objects. chart.to_spec() resolves them:
_PendingBin: single-chart path converts to an unnamedBin(byte-stable); layered path converts to a namedBinfan-out so it does not corrupt the shared unnamed chain._PendingAggregate: defers groupby assignment until all sibling encoding channels are known (Altair-style auto-groupby).
option ¶
Return the value of encoding option name, or default if unset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The option key to look up (e.g. |
required |
default
|
Any
|
Value returned when name is not present. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The option value, or default when the key is absent. |
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 |
required |
aggregate
|
str
|
Aggregation operation applied before mapping (e.g. |
required |
scale
|
Scale
|
Explicit scale override (e.g. |
required |
title
|
str
|
Axis title override. When omitted the field name is used. |
required |
Notes
These additional keyword arguments are honored on positional channels:
sort— ordinal domain order: a list of strings,"ascending"/"descending", or a channel shorthand such as"-y"to sort by the per-category aggregate of another channel.axis— anAxis(...)instance,Falseto suppress the axis, or a raw axis dict.stack—True/ one of"zero","normalize","center", or a falsy spelling (False,"false","null","none") to disable stacking.impute— the options dict Y takes, read with the axes swapped: written onxas the value channel it completes every series the layer draws alongy(the key), fills a null orNaNxin a series, and adds no key for a null,NaNor infinitey. The options, their checks, what a series is and what a render refuses are written once, on Y; here the layer's secondaryy2stands where that text saysx2, andx2where it saysy2.format— a tick-format string, paired withformat_type/formatType("number"or"time").legend— aLegend(...)instance or a raw legend dict. Honored (NF-B13): routed to the same per-channel legend-override style pathColor(legend=...)uses, so an explicitLegend(orient=...)(or similar) takes effect on the chart's legend even thoughxcarries no legend of its own. Per-channel precedence iscolor>x>y; ifColor(legend=...)is also set, its value wins field-by-field. Barelegend=None/legend=Falseis a no-op (nothing is serialized) rather than a suppression: there is no "x's own legend" for that spelling to suppress, so — unlikeColor/Size/Shape, which each own a legend surface —xcannot reach across channels and blank a different one's legend. Suppress the rendered legend from the channel that actually owns it, e.g.Color(legend=None).
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"))
>>> fm.Chart(df).encode(x=fm.X("category", sort="-y"))
to_encoding_spec_dict ¶
Return kwargs for the Rust EncodingSpec constructor / serde JSON.
Iterates this channel's own _honored_kwargs (the single source of
truth) rather than a separate hard-coded key list, so a kwarg is
serialized iff the channel honors it. Each honored key routes through
_SPEC_DICT_HANDLERS to its serializer; keys with no handler
(bin/aggregate) are honored for the warn guard but consumed via
to_implicit_transforms, so they contribute nothing here. legend
is the one key whose serializer depends on more than its own value,
branching on _legend_surface: "own" routes through
_emit_legend; "cascade" (X, Y) routes through
_emit_legend_cascade_only instead, so a bare None/False
cannot suppress a different channel's legend (see that function's
docstring); on "none" legend is not honored, so nothing is
emitted -- _validate_legend_value has already refused every value
except the silent None/False.
Keys are emitted in _SPEC_DICT_ORDER so the dict layout is
stable regardless of frozenset iteration order.
to_implicit_transforms ¶
Return a list of transform objects derived from kwargs (bin, aggregate).
Both bin and aggregate transforms are returned as pending sentinels
rather than concrete Rust objects. chart.to_spec() resolves them:
_PendingBin: single-chart path converts to an unnamedBin(byte-stable); layered path converts to a namedBinfan-out so it does not corrupt the shared unnamed chain._PendingAggregate: defers groupby assignment until all sibling encoding channels are known (Altair-style auto-groupby).
option ¶
Return the value of encoding option name, or default if unset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The option key to look up (e.g. |
required |
default
|
Any
|
Value returned when name is not present. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The option value, or default when the key is absent. |
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"
|
aggregate
|
str
|
Aggregation operation applied before mapping (e.g. |
required |
Examples:
to_encoding_spec_dict ¶
Return kwargs for the Rust EncodingSpec constructor / serde JSON.
Iterates this channel's own _honored_kwargs (the single source of
truth) rather than a separate hard-coded key list, so a kwarg is
serialized iff the channel honors it. Each honored key routes through
_SPEC_DICT_HANDLERS to its serializer; keys with no handler
(bin/aggregate) are honored for the warn guard but consumed via
to_implicit_transforms, so they contribute nothing here. legend
is the one key whose serializer depends on more than its own value,
branching on _legend_surface: "own" routes through
_emit_legend; "cascade" (X, Y) routes through
_emit_legend_cascade_only instead, so a bare None/False
cannot suppress a different channel's legend (see that function's
docstring); on "none" legend is not honored, so nothing is
emitted -- _validate_legend_value has already refused every value
except the silent None/False.
Keys are emitted in _SPEC_DICT_ORDER so the dict layout is
stable regardless of frozenset iteration order.
to_implicit_transforms ¶
Return a list of transform objects derived from kwargs (bin, aggregate).
Both bin and aggregate transforms are returned as pending sentinels
rather than concrete Rust objects. chart.to_spec() resolves them:
_PendingBin: single-chart path converts to an unnamedBin(byte-stable); layered path converts to a namedBinfan-out so it does not corrupt the shared unnamed chain._PendingAggregate: defers groupby assignment until all sibling encoding channels are known (Altair-style auto-groupby).
option ¶
Return the value of encoding option name, or default if unset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The option key to look up (e.g. |
required |
default
|
Any
|
Value returned when name is not present. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The option value, or default when the key is absent. |
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"
|
Examples:
to_encoding_spec_dict ¶
Return kwargs for the Rust EncodingSpec constructor / serde JSON.
Iterates this channel's own _honored_kwargs (the single source of
truth) rather than a separate hard-coded key list, so a kwarg is
serialized iff the channel honors it. Each honored key routes through
_SPEC_DICT_HANDLERS to its serializer; keys with no handler
(bin/aggregate) are honored for the warn guard but consumed via
to_implicit_transforms, so they contribute nothing here. legend
is the one key whose serializer depends on more than its own value,
branching on _legend_surface: "own" routes through
_emit_legend; "cascade" (X, Y) routes through
_emit_legend_cascade_only instead, so a bare None/False
cannot suppress a different channel's legend (see that function's
docstring); on "none" legend is not honored, so nothing is
emitted -- _validate_legend_value has already refused every value
except the silent None/False.
Keys are emitted in _SPEC_DICT_ORDER so the dict layout is
stable regardless of frozenset iteration order.
to_implicit_transforms ¶
Return a list of transform objects derived from kwargs (bin, aggregate).
Both bin and aggregate transforms are returned as pending sentinels
rather than concrete Rust objects. chart.to_spec() resolves them:
_PendingBin: single-chart path converts to an unnamedBin(byte-stable); layered path converts to a namedBinfan-out so it does not corrupt the shared unnamed chain._PendingAggregate: defers groupby assignment until all sibling encoding channels are known (Altair-style auto-groupby).
option ¶
Return the value of encoding option name, or default if unset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The option key to look up (e.g. |
required |
default
|
Any
|
Value returned when name is not present. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The option value, or default when the key is absent. |
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"
|
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 ¶
Return kwargs for the Rust EncodingSpec constructor / serde JSON.
Iterates this channel's own _honored_kwargs (the single source of
truth) rather than a separate hard-coded key list, so a kwarg is
serialized iff the channel honors it. Each honored key routes through
_SPEC_DICT_HANDLERS to its serializer; keys with no handler
(bin/aggregate) are honored for the warn guard but consumed via
to_implicit_transforms, so they contribute nothing here. legend
is the one key whose serializer depends on more than its own value,
branching on _legend_surface: "own" routes through
_emit_legend; "cascade" (X, Y) routes through
_emit_legend_cascade_only instead, so a bare None/False
cannot suppress a different channel's legend (see that function's
docstring); on "none" legend is not honored, so nothing is
emitted -- _validate_legend_value has already refused every value
except the silent None/False.
Keys are emitted in _SPEC_DICT_ORDER so the dict layout is
stable regardless of frozenset iteration order.
to_implicit_transforms ¶
Return a list of transform objects derived from kwargs (bin, aggregate).
Both bin and aggregate transforms are returned as pending sentinels
rather than concrete Rust objects. chart.to_spec() resolves them:
_PendingBin: single-chart path converts to an unnamedBin(byte-stable); layered path converts to a namedBinfan-out so it does not corrupt the shared unnamed chain._PendingAggregate: defers groupby assignment until all sibling encoding channels are known (Altair-style auto-groupby).
option ¶
Return the value of encoding option name, or default if unset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The option key to look up (e.g. |
required |
default
|
Any
|
Value returned when name is not present. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The option value, or default when the key is absent. |
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 |
required |
aggregate
|
str
|
Aggregation operation applied before mapping (e.g. |
required |
scale
|
Scale
|
Explicit scale override (e.g. |
required |
title
|
str
|
Axis title override. When omitted the field name is used. |
required |
Notes
These additional keyword arguments are honored on positional channels:
sort— ordinal domain order: a list of strings,"ascending"/"descending", or a channel shorthand such as"-x"to sort by the per-category aggregate of another channel.axis— anAxis(...)instance,Falseto suppress the axis, or a raw axis dict.stack—True/ one of"zero","normalize","center", or a falsy spelling (False,"false","null","none") to disable stacking.impute— a dict of the optionstransform_imputetakes (method,value,keyvals,frame), each checked astransform_imputechecks it when the channel is built: a value that is not a dict, an option not in that list, a non-finitevalueand a malformedkeyvalsorframeraiseValueError.keyvalsis an ordered sequence (list, tuple,range, array, Series, a generator, a dict'skeys(),values()oritems()view, read in insertion order) or a{"start", "stop", "step"}dict. A bare string (it iterates into characters), a byte string (it iterates into integers), or a set (no order, so the output would change from run to run; pass a list, e.g.sorted(keys)) and a mapping that is not adict(pass a list, ordict(...)for the sequence form) are refused. Written on the value channel, it completes every series the layer draws alongx: a series that lacks anxsome row of the layer holds (or akeyvalsentry) gains one row there, inserted at that key's place in the series, and a null orNaNyin a series is filled the same way. A null,NaNor infinitexadds no key. The fill ismethod:"value"(the default) fillsvalue, which is 0 when omitted on a numeric column and must be given on a date, text or Boolean column;mean,median,minandmaxfill the series' own statistic overframe. A series is the rows that share the values of the channels the mark splits by: a colour the colour scale draws as categories (a text column, or an integer column an area colours) or as bins and, on the marks that draw them,shape,stroke_dashanddetail. A colour drawn continuously splits nothing. A row null on one of those belongs to no series: it is neither filled nor drawn, and no key is completed for it. Each layer completes its own series, so animputewritten on one layer is never read by a sibling. A render refuses an impute written on bothxandy, one with noxchannel to complete along, one beside the layer's own secondaryy2, anxwhose secondaryx2differs among rows sharing the key an imputed row copies, and avalueof a kind the column cannot hold, each with the remedy named.format— a tick-format string, paired withformat_type/formatType("number"or"time").legend— aLegend(...)instance or a raw legend dict. Honored (NF-B13): routed to the same per-channel legend-override style pathColor(legend=...)uses, so an explicitLegend(orient=...)(or similar) takes effect on the chart's legend even thoughycarries no legend of its own. Per-channel precedence iscolor>x>y; ifColor(legend=...)is also set, its value wins field-by-field. Barelegend=None/legend=Falseis a no-op (nothing is serialized) rather than a suppression: there is no "y's own legend" for that spelling to suppress, so — unlikeColor/Size/Shape, which each own a legend surface —ycannot reach across channels and blank a different one's legend. Suppress the rendered legend from the channel that actually owns it, e.g.Color(legend=None).
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"))
>>> fm.Chart(df).encode(y=fm.Y("category", sort="-x"))
to_encoding_spec_dict ¶
Return kwargs for the Rust EncodingSpec constructor / serde JSON.
Iterates this channel's own _honored_kwargs (the single source of
truth) rather than a separate hard-coded key list, so a kwarg is
serialized iff the channel honors it. Each honored key routes through
_SPEC_DICT_HANDLERS to its serializer; keys with no handler
(bin/aggregate) are honored for the warn guard but consumed via
to_implicit_transforms, so they contribute nothing here. legend
is the one key whose serializer depends on more than its own value,
branching on _legend_surface: "own" routes through
_emit_legend; "cascade" (X, Y) routes through
_emit_legend_cascade_only instead, so a bare None/False
cannot suppress a different channel's legend (see that function's
docstring); on "none" legend is not honored, so nothing is
emitted -- _validate_legend_value has already refused every value
except the silent None/False.
Keys are emitted in _SPEC_DICT_ORDER so the dict layout is
stable regardless of frozenset iteration order.
to_implicit_transforms ¶
Return a list of transform objects derived from kwargs (bin, aggregate).
Both bin and aggregate transforms are returned as pending sentinels
rather than concrete Rust objects. chart.to_spec() resolves them:
_PendingBin: single-chart path converts to an unnamedBin(byte-stable); layered path converts to a namedBinfan-out so it does not corrupt the shared unnamed chain._PendingAggregate: defers groupby assignment until all sibling encoding channels are known (Altair-style auto-groupby).
option ¶
Return the value of encoding option name, or default if unset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The option key to look up (e.g. |
required |
default
|
Any
|
Value returned when name is not present. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The option value, or default when the key is absent. |
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"
|
aggregate
|
str
|
Aggregation operation applied before mapping (e.g. |
required |
Examples:
to_encoding_spec_dict ¶
Return kwargs for the Rust EncodingSpec constructor / serde JSON.
Iterates this channel's own _honored_kwargs (the single source of
truth) rather than a separate hard-coded key list, so a kwarg is
serialized iff the channel honors it. Each honored key routes through
_SPEC_DICT_HANDLERS to its serializer; keys with no handler
(bin/aggregate) are honored for the warn guard but consumed via
to_implicit_transforms, so they contribute nothing here. legend
is the one key whose serializer depends on more than its own value,
branching on _legend_surface: "own" routes through
_emit_legend; "cascade" (X, Y) routes through
_emit_legend_cascade_only instead, so a bare None/False
cannot suppress a different channel's legend (see that function's
docstring); on "none" legend is not honored, so nothing is
emitted -- _validate_legend_value has already refused every value
except the silent None/False.
Keys are emitted in _SPEC_DICT_ORDER so the dict layout is
stable regardless of frozenset iteration order.
to_implicit_transforms ¶
Return a list of transform objects derived from kwargs (bin, aggregate).
Both bin and aggregate transforms are returned as pending sentinels
rather than concrete Rust objects. chart.to_spec() resolves them:
_PendingBin: single-chart path converts to an unnamedBin(byte-stable); layered path converts to a namedBinfan-out so it does not corrupt the shared unnamed chain._PendingAggregate: defers groupby assignment until all sibling encoding channels are known (Altair-style auto-groupby).
option ¶
Return the value of encoding option name, or default if unset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The option key to look up (e.g. |
required |
default
|
Any
|
Value returned when name is not present. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The option value, or default when the key is absent. |
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"
|
Examples:
to_encoding_spec_dict ¶
Return kwargs for the Rust EncodingSpec constructor / serde JSON.
Iterates this channel's own _honored_kwargs (the single source of
truth) rather than a separate hard-coded key list, so a kwarg is
serialized iff the channel honors it. Each honored key routes through
_SPEC_DICT_HANDLERS to its serializer; keys with no handler
(bin/aggregate) are honored for the warn guard but consumed via
to_implicit_transforms, so they contribute nothing here. legend
is the one key whose serializer depends on more than its own value,
branching on _legend_surface: "own" routes through
_emit_legend; "cascade" (X, Y) routes through
_emit_legend_cascade_only instead, so a bare None/False
cannot suppress a different channel's legend (see that function's
docstring); on "none" legend is not honored, so nothing is
emitted -- _validate_legend_value has already refused every value
except the silent None/False.
Keys are emitted in _SPEC_DICT_ORDER so the dict layout is
stable regardless of frozenset iteration order.
to_implicit_transforms ¶
Return a list of transform objects derived from kwargs (bin, aggregate).
Both bin and aggregate transforms are returned as pending sentinels
rather than concrete Rust objects. chart.to_spec() resolves them:
_PendingBin: single-chart path converts to an unnamedBin(byte-stable); layered path converts to a namedBinfan-out so it does not corrupt the shared unnamed chain._PendingAggregate: defers groupby assignment until all sibling encoding channels are known (Altair-style auto-groupby).
option ¶
Return the value of encoding option name, or default if unset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The option key to look up (e.g. |
required |
default
|
Any
|
Value returned when name is not present. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The option value, or default when the key is absent. |
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"
|
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 ¶
Return kwargs for the Rust EncodingSpec constructor / serde JSON.
Iterates this channel's own _honored_kwargs (the single source of
truth) rather than a separate hard-coded key list, so a kwarg is
serialized iff the channel honors it. Each honored key routes through
_SPEC_DICT_HANDLERS to its serializer; keys with no handler
(bin/aggregate) are honored for the warn guard but consumed via
to_implicit_transforms, so they contribute nothing here. legend
is the one key whose serializer depends on more than its own value,
branching on _legend_surface: "own" routes through
_emit_legend; "cascade" (X, Y) routes through
_emit_legend_cascade_only instead, so a bare None/False
cannot suppress a different channel's legend (see that function's
docstring); on "none" legend is not honored, so nothing is
emitted -- _validate_legend_value has already refused every value
except the silent None/False.
Keys are emitted in _SPEC_DICT_ORDER so the dict layout is
stable regardless of frozenset iteration order.
to_implicit_transforms ¶
Return a list of transform objects derived from kwargs (bin, aggregate).
Both bin and aggregate transforms are returned as pending sentinels
rather than concrete Rust objects. chart.to_spec() resolves them:
_PendingBin: single-chart path converts to an unnamedBin(byte-stable); layered path converts to a namedBinfan-out so it does not corrupt the shared unnamed chain._PendingAggregate: defers groupby assignment until all sibling encoding channels are known (Altair-style auto-groupby).
option ¶
Return the value of encoding option name, or default if unset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The option key to look up (e.g. |
required |
default
|
Any
|
Value returned when name is not present. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The option value, or default when the key is absent. |