Skip to content

scale_continuous

scale_continuous(
    aesthetic: str | Sequence[str],
    *,
    name: str | None = None,
    breaks: Breaks | None = None,
    labels: Labels | None = None,
    lablim: int | None = None,
    limits: Limits | None = None,
    expand: Sequence[Number] | None = None,
    oob: Oob | PositionOob | None = None,
    na_value: Color | Number | None = None,
    guide: Guide | None = None,
    trans: Transform | None = None,
    format: str | None = None,
    scale_mapper_kind: str | None = None,
    **kwargs: Any,
) -> FeatureSpec

Map any aesthetic, or several at once, continuously.

Color aesthetics (color, fill, paint_*) get a gradient unless scale_mapper_kind says otherwise.

Parameters:

  • aesthetic (str or list of str) –

    The aesthetic(s) the scale maps, e.g. "size" or ["x", "y"].

  • name (str, default: None ) –

    Axis label or legend title.

  • breaks (list or dict, default: None ) –

    Values that get a tick or a legend key (a dict maps labels to breaks).

  • labels (list of str or dict, default: None ) –

    One label per break (a dict maps breaks to labels).

  • lablim (int, default: None ) –

    Ignored on continuous scales, with a warning, as in lets-plot.

  • limits (list, default: None ) –

    [low, high] data range of the scale.

  • expand (list of float, default: None ) –

    [multiplicative, additive] expansion of a position scale.

  • oob ((censor, squish, keep), default: "censor" ) –

    What data outside limits maps to. "keep" is for x and y only. Not in lets-plot (ggplot2 oob).

  • na_value (optional, default: None ) –

    Value drawn for missing data and data outside limits.

  • guide (str or FeatureSpec, default: None ) –

    "legend", "colorbar" (color), "none", or a guide spec.

  • trans (str, default: None ) –

    Transformation of the data: identity, log10, log2, log, log1p, exp, logit, probit, reciprocal, pseudo_log, symlog, sqrt, reverse, or boxcox_trans(p).

  • format (str, default: None ) –

    Label format, e.g. ".1f". labels take precedence.

  • scale_mapper_kind (str, default: None ) –

    The color mapper, e.g. "color_gradient" or "color_hue".

  • **kwargs (Any) –

    Options of the mapper (low=, high=, ...) or of a position scale (position=, break_width=).

Returns:

  • FeatureSpec –

    The scale, or a FeatureSpecArray of one scale per aesthetic for a list.

Raises:

Examples:

>>> from ggrust import *
>>> data = {"x": [0, 1, 2, 3], "y": [0, 1, 4, 9]}
>>> plot = ggplot(data, aes("x", "y")) + geom_point(size=8)
>>> plot = plot + scale_continuous(["x", "y"], expand=[0, 0])