scale_alpha_binned ¶
scale_alpha_binned(
range: Sequence[Number] | None = None,
name: str | None = None,
breaks: Breaks | None = None,
labels: Labels | None = None,
limits: Limits | None = None,
n_breaks: int | None = None,
nice_breaks: bool = True,
right: bool = True,
show_limits: bool = False,
oob: Oob = "squish",
na_value: Number | None = None,
guide: Guide | None = None,
trans: Transform | None = None,
format: str | None = None,
) -> FeatureSpec
Map alpha to binned transparency (ggplot2).
Each value takes the alpha at the middle of its bin. The legend is
guide_bins(). Options as in scale_size_binned.
Parameters:
-
range(list of float, default:None) –[lowest, highest]alpha (default 0.1..1). -
name(str, default:None) –Legend title.
-
breaks(list, default:None) –Bin edges inside the data range (data units).
-
labels(list of str or dict, default:None) –One label per break.
-
limits(list, default:None) –[low, high]range of the bins. -
n_breaks(int, default:None) –How many breaks to aim for (default 5).
-
nice_breaks(bool, default:True) –Round break values.
-
right(bool, default:True) –Bins are closed on the right.
-
show_limits(bool, default:False) –Also label the two outer edges of the legend.
-
oob((squish, censor), default:"squish") –What data outside
limitsmaps to. -
na_value(float, default:None) –Alpha of missing data.
-
guide(str or FeatureSpec, default:None) –"bins"(default),"legend","none", or a guide spec. -
trans(str, default:None) –Transformation of the data.
-
format(str, default:None) –Label format.
labelstake precedence.
Returns:
-
FeatureSpec–The scale.
Raises:
-
SpecError–If
oobis not"squish"or"censor".
Examples:
>>> from ggrust import *
>>> data = {"x": [1, 2, 3, 4, 5], "y": [2, 4, 3, 5, 1], "score": [3, 18, 41, 66, 97]}
>>> plot = ggplot(data, aes("x", "y", alpha="score")) + geom_point(size=8)
>>> plot = plot + scale_alpha_binned()