scale_linewidth ¶
scale_linewidth(
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
Line widths for linewidth: data mapped linearly onto range.
linewidth sets the width of lines in lollipops, ranges, ribbons and other
geoms that draw a line next to their points.
Parameters:
-
range(list of float, default:None) –[thinnest, thickest]width (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 getsna_value. -
na_value(float, default:None) –Width of missing data and data outside
limits(default 1). -
guide(str or FeatureSpec, default:None) –"legend","none", or aguide_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} %").labelstake precedence.
Returns:
-
FeatureSpec–The scale.
Examples:
>>> from ggrust import *
>>> data = {"city": ["Oslo", "Rome", "Lima", "Cairo"], "low": [-7, 3, 15, 9],
... "high": [22, 31, 26, 35], "mean": [6, 16, 19, 22],
... "sunny_days": [120, 250, 140, 330]}
>>> plot = ggplot(data, aes("city", "mean", ymin="low", ymax="high"))
>>> plot = plot + geom_pointrange(aes(linewidth="sunny_days"))
>>> plot = plot + scale_linewidth(range=[0.5, 4])