(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