Skip to content

scale_stroke

scale_stroke(
    range: Sequence[Number] | None = None,
    name: str | None = None,
    breaks: Breaks | None = None,
    labels: Labels | None = None,
    lablim: int | None = None,
    limits: Limits | None = None,
    na_value: Number | None = None,
    guide: Guide | None = None,
    trans: Transform | None = None,
    format: str | None = None,
) -> FeatureSpec

Outline widths for stroke: data mapped linearly onto range.

stroke is the outline of point shapes 0..14 and 19..25; outlined points grow with it.

Parameters:

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

    [thinnest, thickest] outline (default [1, 7], 2.2 to 15.4 px).

  • name (str, default: None ) –

    Legend title.

  • breaks (list, default: None ) –

    Values that get a legend key.

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

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

  • lablim (int, default: None ) –

    Maximum label length in characters; longer labels are cut.

  • limits (list, default: None ) –

    [low, high] data range of a continuous scale, or the levels (and their order) of a discrete one. Data outside the limits gets na_value.

  • na_value (float, default: None ) –

    Outline of missing data and data outside limits (default 1).

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

    "legend", "none", or a guide_legend() spec.

  • trans ((identity, log10, log2, sqrt, reverse), default: 'identity' ) –

    Map (and pick legend breaks) in transformed units.

  • format (str, default: None ) –

    Label format: a number format (".2f", ",", "%") or a template ("{.1f} %"). labels take precedence.

Returns:

  • FeatureSpec –

    The scale.

Examples:

>>> from ggrust import *
>>> data = {"fruit": ["apple", "pear", "plum", "fig"], "price": [2.1, 2.8, 3.5, 6.0],
...         "sweetness": [6, 7, 5, 9]}
>>> plot = ggplot(data, aes("fruit", "price", stroke="sweetness"))
>>> plot = plot + geom_point(shape=21, size=6, fill="gold") + scale_stroke(range=[0.5, 3])