I have my dataframe:
test<-data.frame(F1=c(1,2,3,4,5),F2=c(3,4,5,6,7),Group=c("G1","G2","G2","G3","G1"))
I try to set up different point color at different condition:
FF<-function(Ture_or_not){
p<-ggplot(test,aes(x=F1,y=F2))+
geom_point(aes(color=Group),size=10)+
scale_color_manual(values=ifelse(Ture_or_not==TRUE,c("yellow","red","black"),c("black","black","black")))
p
}
FF(TRUE)
But I got:
Error: Insufficient values in manual scale. 3 needed but only 1 provided.
Run `rlang::last_error()` to see where the error occurred.
May I know what's the problem?
Aucun commentaire:
Enregistrer un commentaire