本文介绍了在 R 中组合图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
组合使用 plot(resid(lme)) 绘制的两个残差图,其中 lme 是线性混合模型. 合并使用 interaction.plot(x1,x2,y) 绘制的两个交互图,其中 x1 和 x2 是两个自变量,y 是因变量.
Combine two residual plots plotted by using plot(resid(lme)) where lme is a linear mixed model.
Combine two interaction plots plotted by using interaction.plot(x1,x2,y) where x1 and x2 are the two independent variables, and y is the dependent variable.
我有几个图想将它们组合在一起并为组合图添加标题,但不知何故我无法使用 R 组合它们.(使用 RStudio)
I have several plots that I want to combine them together and add a title to the combined plot, but somehow I cannot combine them using R. (using RStudio)
我尝试将绘图存储为变量并使用 grid.arrange,但它们无法存储到变量中(仅在绘图区域生成绘图).
I tried to store the plots as variables and use grid.arrange, but they cannot be stored into a variable (just produce the plot in the plot area).
即
> int1 <- interaction.plot(data_pos_10$Day,data_pos_10$Drug,data_pos_10$Tumor.Volume, + xlab="Day",ylab="Tumor Volume",main="Interaction Plot Batch 10", + legend=F, + col=c("red","red","green","black","blue"), + lwd=2, + lty=c(1,2,3,4,5)) > int1 NULL 推荐答案在绘制代码之前,运行 par(mcol=c(2,1)) 以垂直堆叠它们或 par(mcol=c(1,2)) 水平堆叠它们.
Before you do your plotting code, run par(mcol=c(2,1)) to stack them vertically or par(mcol=c(1,2)) to stack them horizontally.
更多推荐
在 R 中组合图
发布评论