【问题标题】:Combine plots in R在 R 中组合图
【发布时间】:2014-03-10 19:42:16
【问题描述】:

我有几个图,我想将它们组合在一起并为组合图添加标题,但不知何故我无法使用 R 组合它们。(使用 RStudio)

  1. 合并使用plot(resid(lme)) 绘制的两个残差图,其中 lme 是线性混合模型。
  2. 组合使用interaction.plot(x1,x2,y) 绘制的两个交互图,其中 x1 和 x2 是两个自变量,y 是因变量。

我尝试将绘图存储为变量并使用grid.arrange,但它们无法存储到变量中(只需在绘图区域生成绘图)。

> 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

【问题讨论】:

    标签: r plot interaction gridextra


    【解决方案1】:

    在编写绘图代码之前,运行par(mcol=c(2,1)) 将它们垂直堆叠或运行par(mcol=c(1,2)) 将它们水平堆叠。

    【讨论】:

    • 是的,它有效。但是如何为组合图添加标题?谢谢!
    • 试试?mtext作为标题。
    • 我想我明白了,然后运行 ​​'title("...")'。
    猜你喜欢
    • 2020-05-24
    • 1970-01-01
    • 1970-01-01
    • 2015-06-08
    • 2021-03-31
    • 1970-01-01
    • 1970-01-01
    • 2012-12-16
    相关资源
    最近更新 更多