使用gridExtra的多个点阵图

Max*_*ian 2 r lattice

绘制多个图形非常方便,并且使用gridExtra - grid.arrange:

grid.arrange(plot1,plot2,plot3,plot4,plot5,plot6,plot7,plot8,plot9, ncol=3)
Run Code Online (Sandbox Code Playgroud)

上面的命令在一个窗口中绘制3x3图形.

现在,我正在使用我自己的点阵设置来绘制独特的线条等

trellis.par.set(my.setup)
Run Code Online (Sandbox Code Playgroud)

但是,使用grid.arrange命令绘制多个绘图将不会传递设置,因为输出绘图是默认颜色.

所以问题是如何传递my.setup到grid.arrange或者如何在格子中一次性容易地绘制多个图形.

编辑:可重复的例子:

Data <- data.frame(Col1=rnorm(10,0,1),Col2=rexp(10,2),Col3=rnorm(10,2,2),Col4=runif(10,0,2), 
       Time=seq(1,10,1))

trellis.par.set(col.whitebg()) 
newSet <- col.whitebg() 
newSet$superpose.symbol$col <- c("blue3","orange2","gray1","tomato3")
newSet$superpose.symbol$pch <- 1
newSet$superpose.symbol$cex <- 1
newSet$superpose.line$col <- c("blue3","orange2","gray1","tomato3")
trellis.par.set(newSet)

Plot1 <- xyplot(Col1+Col2~Time, Data, type="spline")
Plot2 <- xyplot(Col2+Col3~Time, Data, type="spline")
Plot3 <- xyplot(Col1+Col3~Time, Data, type="spline")
Plot4 <- xyplot(Col3+Col4~Time, Data, type="spline")

grid.arrange(Plot1,Plot2,Plot3,Plot4, ncol=2)
Run Code Online (Sandbox Code Playgroud)

bap*_*ste 7

我想这与该plot.trellis方法没有找到全局主题设置有关gridExtra::drawDetails.lattice.我不明白这些格子选项,但据我记得你也可以在情节层面明确指定它们,

pl = list(Plot1, Plot2, Plot3, Plot4)
# do.call(grid.arrange, c(pl, nrow=1))
do.call(grid.arrange, c(lapply(pl, update, par.settings=newSet), list(nrow=1)))
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述