[英]How to combine 3 different line plots in one plot
假設我有 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")
現在我需要將所有這三個圖組合在一張圖中。 有人可以幫我找到答案嗎?
提前致謝!
您可以在任何plot()
命令之前使用par(mfrow = c(1, 3))
來分割顯示。 之后,每次調用plot()
都將使用一個新部分。 有關詳細信息,請參閱?par
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.