-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behavior
Description
I'm trying to use a fixed alpha aesthetic to manually highlight points in a plot. It fails when color is mapped to a factor.
library(ggplot2)
data(mtcars)
# fails (but should work)
ggplot(mtcars, aes(x=disp, y=hp, color=as.factor(cyl)))+geom_point(alpha=seq(0,1,length.out=32))
# Error: Aesthetics must be either length 1 or the same as the data (3): alpha
# fails (and should fail)
ggplot(mtcars, aes(x=disp, y=hp, color=as.factor(cyl)))+geom_point(alpha=seq(0,1,length.out=3))
# Error: Aesthetics must be either length 1 or the same as the data (32): alpha
# succeeds
ggplot(mtcars, aes(x=disp, y=hp, color=cyl))+geom_point(alpha=seq(0,1,length.out=32))
Tested on version 2.2.0
Metadata
Metadata
Assignees
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behavior