我想使用ggplot在多个列上循环以创建多个绘图,但在for循环中使用占位符会改变ggplot的行为.
如果我有这个:
t <- data.frame(w = c(1, 2, 3, 4), x = c(23,45,23, 34),
y = c(23,34,54, 23), z = c(23,12,54, 32))
这很好:
ggplot(data=t, aes(w, x)) + geom_line()
但这并不是:
i <- 'x'
ggplot(data=t, aes(w, i)) + geom_line()
如果我想最终在x,y和z上循环,这是个问题.