我可以为R中有一行代码的所有绘图打开网格吗?

我可以为R中有一行代码的所有绘图打开网格吗?,r,plot,R,Plot,我是否可以为r中的所有绘图打开网格,而不是在每个绘图后使用grid()?比如 plot(1:10) grid() plot(2:20) grid() plot(3:30) grid() 编写一个包装函数: myplot <- function(x, ...) { plot(x, panel.first = grid(), ...) } myplot谢谢。除了包装函数之外,我们是否还有类似于par(grid=T)或意见(grid=T)?否-请参阅ggplot2包中的ggplot()。

我是否可以为r中的所有绘图打开网格,而不是在每个绘图后使用
grid()
?比如

plot(1:10)
grid()
plot(2:20)
grid()
plot(3:30)
grid()

编写一个包装函数:

myplot <- function(x, ...) {
  plot(x, panel.first = grid(), ...)
}

myplot谢谢。除了包装函数之外,我们是否还有类似于
par(grid=T)
或意见(grid=T)?否-请参阅ggplot2包中的
ggplot()。
xx <- list(a = 1:10, b = 2:20, c = 3:30)
layout(matrix(1:3, ncol = 3))
for (i in seq_along(xx)) {
  myplot(xx[[i]])
}
layout(1)