This is driving me crazy... Sorry if it is trivial. I Searched but did not find help. First of all a reproducible example
df = data.frame(idx = c(1,2,3,4,5), label=c(0,0,1,1,0),
filter = c(1,1,0,1,1), values = c(0.1, 0.3, 1.2, 1.7, 2.4))
ggplot (df, aes(x = df$idx, y = df$values, size = as.factor(df$label*filter),
color = as.factor(df$label*filter)))+geom_point()+
scale_colour_manual(name = "Duplicates (J/N)", labels = c("Nein", "Ja"),
values = c("red", "blue")) + scale_size_manual(name = "Duplicates (J/N)",
labels = c("Nein", "Ja"), values = c("red", "blue"))
When I run this example I get the error
Error in coords$size * .pt : non-numeric argument to binary Operator
Now usually in ggplot you get this error when you got too many + or not enough +. But it does not seem to be the case here. At least is not evident to me.
This is working (without the scale_size_manual
)
ggplot (df, aes(x = df$idx, y = df$values, size = as.factor(df$label*filter),
color = as.factor(df$label*filter)))+geom_point()+
scale_colour_manual(name = "Duplicates (J/N)", labels = c("Nein", "Ja"),
values = c("red", "blue"))
Anyone spot the mistake??
Thanks in advance for the help!