It is easy to put plots created by the same function into one page using par or multiplot function, but I can't figure out the above question.推荐答案您可以使用 gridBase 包和 viewPorts 来做到这一点.You can do this using the gridBase package and viewPorts.library(grid)library(gridBase)library(ggplot2)# start new pageplot.new()# setup layoutgl <- grid.layout(nrow=1, ncol=2)# grid.show.layout(gl)# setup viewportsvp.1 <- viewport(layout.pos.col=1, layout.pos.row=1)vp.2 <- viewport(layout.pos.col=2, layout.pos.row=1)# init layoutpushViewport(viewport(layout=gl))# access the first positionpushViewport(vp.1)# start new base graphics in first viewportpar(new=TRUE, fig=gridFIG())plot(x = 1:10, y = 10:1)# done with the first viewportpopViewport()# move to the next viewportpushViewport(vp.2)ggplotted <- qplot(x=1:10,y=10:1, 'point')# print our ggplot graphics hereprint(ggplotted, newpage = FALSE)# done with this viewportpopViewport(1)这个例子是这篇博文的修改版,作者是迪伦博德特This example is a modified version of this blog post by Dylan Beaudette 这篇关于'plot' 和 'ggplot' 并排生成的图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!