在 R 中合并两个不同的图

Merging two different Plots in R

我想在 R 中将两个图合并到一个图中,但我不知道如何完成它

第一个情节:

     plot_1 <- plot(serie_2,dt_frame$students,main="Plot 1",col=1,pch=19)

第二个情节:

      plot_2 <- plot(serie_3,dt_frame$numbers,main="Plot 2",col=5,pch=19)

如何在一个图中显示这些单独的图

你可以使用 ggplot2:

library(ggplot2)

ggplot() +
 geom_point(aes(x=serie_2, y=dt_frame$students, col="blue")) +
 geom_point(aes(x=serie_3, y=dt_frame$numbers, col="red")) +
 labs(x = "Student", y = "Grade") +
 scale_color_manual(values=c("blue", "red"),
                    labels=c("Series 2", "Series 3"))