Learn R Programming

ggplot2 (version 2.0.0)

scale_alpha: Alpha scales.

Description

scale_alpha is an alias for scale_alpha_continuous since that is the most common use of alpha, and it saves a bit of typing.

Usage

scale_alpha(..., range = c(0.1, 1))

scale_alpha_continuous(..., range = c(0.1, 1))

scale_alpha_discrete(..., range = c(0.1, 1))

Arguments

...
Other arguments passed on to continuous_scale or discrete_scale as appropriate, to control name, limits, breaks, labels and so forth.
range
range of output alpha values. Should lie between 0 and 1.

Examples

Run this code
(p <- ggplot(mtcars, aes(mpg, cyl)) +
  geom_point(aes(alpha = cyl)))
p + scale_alpha("cylinders")
p + scale_alpha("number\nof\ncylinders")

p + scale_alpha(range = c(0.4, 0.8))

(p <- ggplot(mtcars, aes(mpg, cyl)) +
  geom_point(aes(alpha = factor(cyl))))
p + scale_alpha_discrete(range = c(0.4, 0.8))

Run the code above in your browser using DataLab