R 如何在一个绘图中组合3个不同的直线绘图

R 如何在一个绘图中组合3个不同的直线绘图,r,plot,line,R,Plot,Line,假设我有3个年龄组:婴儿、成人和老年人。 在每组中,我有3个科目。对于每个年龄组,我将绘制一个组合线图: p1 <- plot(infants$`8838`, type="l", col="blue", ylim = c(0, 0.90), xlim = c(0,3000)) lines(infants$`9048`, typr = "l", col="red") lines(infants$`9108`, typr = "l", col="green") p2

假设我有3个年龄组:婴儿、成人和老年人。 在每组中,我有3个科目。对于每个年龄组,我将绘制一个组合线图:

p1 <- plot(infants$`8838`, type="l", col="blue", ylim = c(0, 0.90), xlim = c(0,3000))
       lines(infants$`9048`, typr = "l", col="red")
       lines(infants$`9108`, typr = "l", col="green")
p2 <- plot(adol$`8804`, type="l", col="blue", ylim = c(0, 0.90), xlim = c(0,3000))
    lines(adol$`12291`, typr = "l", col="red")
    lines(adol$`12623`, typr = "l", col="green")
p3 <- plot(old$`10341`, type="l", col="blue", ylim = c(0, 0.90), xlim = c(0,3000))
    lines(old$`10690`, typr = "l", col="red")
    lines(old$`10896`, typr = "l", col="green")

p1您可以在任何
plot()
命令之前使用
par(mfrow=c(1,3))
对显示进行分区。之后,每次调用
plot()
都将使用一个新的节。有关详细信息,请参见
?par

请根据这些内容编辑您的问题。(基于意见)是否可以使用
ggplot2
?它似乎“更容易”使用。在所有命令之前,键入
op