Skip to content

Render Config

RenderConfig for auto-raster, scale, and output tuning.

Ferrum — a statistical visualization library with a Rust core.

RenderConfig dataclass

Per-chart rendering configuration.

Controls the auto-raster policy that transparently substitutes mark_raster for per-element marks when the mark count exceeds raster_threshold. This prevents multi-million-row charts from producing impractically large SVG output.

For one-off overrides, prefer the raster= keyword on output methods (chart.show(raster=False), chart.save(..., raster=False), chart.to_svg(raster=False)). Use RenderConfig when you want to bake the policy into the chart object itself.

Parameters:

Name Type Description Default
raster_threshold int or None

Mark count above which auto-raster fires. None disables auto-raster entirely.

500_000
raster_behavior ('warn', 'silent', 'error')

"warn" emits a UserWarning when auto-raster substitutes. "silent" substitutes without warning. "error" raises ValueError instead of substituting.

"warn"
raster_aggregate str

Aggregation function for the substituted mark_raster, validated against the live transform_registry("raster")["methods"] vocabulary (spec §4.6). Aggregates in transform_registry("raster")["methods_needing_field"] require raster_field to also be set, since they aggregate a value column rather than counting rows. Any other value (e.g. "max"/"min"/ "median", which are not valid raster aggregates) raises ValueError at construction.

Quantitative color and auto-raster. An over-threshold chart with a quantitative color encoding is eligible for auto-raster: the substitution defaults to aggregate="mean" over the color field (plus the color channel's own scheme= when it declared one, else raster_scheme) so the color information survives rasterisation instead of being discarded. Passing raster_aggregate/raster_field explicitly here overrides that default wholesale -- the color field is then ignored and this config's values are used as-is. A categorical, ordinal, or temporal color encoding is excluded from auto-raster permanently, not merely "not yet implemented" -- rasterising would collapse the category to one summary pixel color per bin, discarding the information the color channel exists to show. There is no RenderConfig setting that lifts this exclusion; rasterize such a chart explicitly with chart.mark_raster(aggregate=..., field=...) instead, accepting that the categories collapse into a chosen numeric aggregate.

"count"
raster_scheme str or None

Colormap (color scheme) for the substituted mark_raster. None defers to the built-in "viridis" default.

None
raster_cmap str or None

Back-compat alias for raster_scheme. Pass at most one of the two; after construction it reads back as the resolved raster_scheme.

None
raster_field str or None

Column name to aggregate when raster_aggregate is one of transform_registry("raster")["methods_needing_field"]. Genuinely ignored for every other aggregate: it is dropped before the substitution, so it is never resolved as a column name and an unrelated or nonexistent value here has no effect and never raises. The column must be numeric; integer columns are coerced to Float64 automatically (batch-D T2 numeric coercion), so an Int64/Int32/etc. column works unchanged. A genuinely non-numeric column (e.g. a string column) raises stat_raster: column '...' must be numeric, got <Type> at render time (a pre-existing constraint of the underlying Raster transform, not new to this field) -- this is narrower than the stale "must be Float64" wording this docstring carried before the #136 probe (2026-09-12): the Float64-only claim predated the coercion and no longer holds.

None