Skip to contents

Maps data values to alpha transparency.

Usage

scale_alpha(
  plot,
  name = ggplot2::waiver(),
  trans = NULL,
  limits = NULL,
  range = NULL,
  breaks = NULL,
  labels = NULL,
  ...
)

Arguments

plot

A plotit object.

name

Scale title (legend name).

trans

Scale transformation. NULL auto-detects, otherwise one of: "identity", "discrete", "reverse", "binned". Unsupported values (e.g. "log") produce a targeted error message.

limits

Data domain.

range

Output alpha range as c(min, max). NULL = default c(0.1, 1). Only meaningful for continuous scales.

breaks

Legend key positions.

labels

Legend key labels.

...

Passed to the underlying ggplot2 scale function.

Value

A modified plotit object.

Examples

plotit(mtcars, encode(x = wt, y = mpg, alpha = hp)) |>
  mark_point() |>
  scale_alpha()