问题 I'll skip right to an example and comment afterwords: cont <- data.frame(value = c(1:20),variable = c(1:20,(1:20)^1.5,(1:20)^2),group=rep(c(1,2,3),each=20)) value variable group 1 1 1.000000 1 2 2 2.000000 1 3 3 3.000000 1 #... etc. #ser is shorthand for "series". plot_scat <- function(data,x,y,ser) { ggplot(data,aes(x=x,y=y,color=factor(ser)))+geom_point() } plot_scat(cont,value,variable,group) #This gives the error: #Error in eval(expr,envir,enclose) : object 'x' not found Now, I know that