Skip to content

scale_color_cmapmpl

scale_color_cmapmpl(
    cmap: str | Colormap,
    *,
    name: str | None = None,
    breaks: Breaks | None = None,
    labels: Labels | None = None,
    lablim: int | None = None,
    limits: Limits | None = None,
    na_value: Color | Number | None = None,
    guide: Guide | None = None,
    trans: Transform | None = None,
    format: str | None = None,
) -> FeatureSpec

Map color through a matplotlib color map.

Parameters:

  • cmap (str or matplotlib colormap) –

    A name in matplotlib.colormaps, or a colormap object.

  • name (str, default: None ) –

    The legend title.

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

    Legend breaks, or a mapping of labels to breaks.

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

    Legend labels.

  • lablim (int, default: None ) –

    Longest label, in characters.

  • limits (list, default: None ) –

    The range of the scale.

  • na_value (str, default: None ) –

    Color of missing values.

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

    guide_legend() / guide_colorbar() 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.

Returns:

  • FeatureSpec –

    The scale.

Raises:

  • SpecError –

    If matplotlib is not installed or cmap is not a known color map.

Examples:

>>> from ggrust import *
>>> data = {"x": [1, 2, 3], "y": [1, 2, 3], "z": [1, 2, 3]}
>>> plot = ggplot(data, aes("x", "y", color="z")) + geom_point()
>>> plot = plot + scale_color_cmapmpl("plasma")