乳胶编织器块echo=FALSE会破坏par()设置



我是latex和Knitter的新手,当我使用echo=FALSE时,R块的输出有问题。下面的.Rnw代码按预期工作,即输出具有

    1. some code
    2. a block of figures arranged 2 x 3
    3. some more code
    4. a block of figures arranged 2 x 3

然而,更改块打开以从输出中消除代码块

<<bghist2_mas_rma, fig.height=4, fig.width=6, echo=FALSE>>=

不仅从输出中删除代码(好),而且还超越了par()设置,使两个图形(每个2 x 3)在页面上相邻放置,第二个图形的大部分都从边缘掉下来。

除了简单地将代码留在输出中之外,我如何绕过这一点?

感谢

B

newpage
<<bghist2_mas_rma, fig.height=4, fig.width=6, echo=TRUE>>=
par(mfrow=c(2,3))
for(i in 1:6){
    hist(bg.mas[,i], xlab="", las=1,
    main=paste(sep="", "bg.mas[, ",  i, "]"),
    xlim=c(-100, 300), breaks=10000)
}
par(mfrow=c(1,1))
par(mfrow=c(2,3))
for(i in 1:6){
    hist(bg.rma[,i], xlab="", las=1,
    main=paste(sep="", "bg.rma[, ",  i, "]"),
    xlim=c(-100, 300), breaks=10000)
}
par(mfrow=c(1,1))
@

最简单的解决方案是将它们拆分为单独的块:

<<bghist2_mas_rma, fig.height=4, fig.width=6, echo=FALSE>>=
par(mfrow=c(2,3))
for(i in 1:6){
    hist(bg.mas[,i], xlab="", las=1,
    main=paste(sep="", "bg.mas[, ",  i, "]"),
    xlim=c(-100, 300), breaks=10000)
}
@
<<bghist2_mas_rma_2, fig.height=4, fig.width=6, echo=FALSE>>=
par(mfrow=c(2,3))
for(i in 1:6){
    hist(bg.rma[,i], xlab="", las=1,
    main=paste(sep="", "bg.rma[, ",  i, "]"),
    xlim=c(-100, 300), breaks=10000)
}
par(mfrow=c(1,1))
@

最新更新