[英]ggplot axis.title description in one line function
I have a problem with my own function. 我的功能有问题。 I mean, I create a function in which arguments will be name of axis.title.
我的意思是,我创建了一个函数,其中参数将是axis.title的名称。
describe_axis <- function(x_axis, y_axis){
y <- y_axis
x <- x_axis
xlab(x)+
ylab(y)
}
If I use it in normal ggplot code: 如果我在普通的ggplot代码中使用它:
ggplot(mtcars, aes(wt, qsec))+
geom_point()+
describe_axis("X-axis","Y-axis")
I get an error non-numeric argument to binary operator
. 我得到
non-numeric argument to binary operator
的错误non-numeric argument to binary operator
。 How to manage with it? 如何管理呢?
如果您要标记轴:
ggplot(mtcars, aes(wt, qsec))+ geom_point()+ xlab("X-axis") + ylab("Y-axis")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.