Вы можете попробовать plot_grid
из пакета cowplot
.Обратите внимание, что cowplot
требует R 3.5.0
.
Редактировать: чтобы уточнить, вам нужна версия для разработки cowplot
на GitHub
devtools::install_github("wilkelab/cowplot")
library(car)
library(gridGraphics)
library(cowplot)
par(xpd = NA, # switch off clipping, necessary to always see axis labels
bg = "transparent", # switch off background to avoid obscuring adjacent plots
oma = c(1, 1, 2, 1),
mar = c(4, 4, 0, 1),
mgp = c(2, 1, 0), # move axis labels closer to axis
cex.lab = 1,
cex.axis = 0.8
)
scatterplot(mpg ~ disp, data=mtcars, smooth=F, boxplots=F, xlab="", ylab="mpg", grid=F)
rec1 <- recordPlot() # record the previous plot
scatterplot(mpg ~ wt, data=mtcars, smooth=F, boxplots=F, xlab="", ylab="", grid=F)
rec2 <- recordPlot()
scatterplot(hp ~ disp, data=mtcars, smooth=F, boxplots=F, xlab="hp", ylab="mpg", grid=F)
rec3 <- recordPlot()
scatterplot(hp ~ wt, data=mtcars, smooth=F, boxplots=F, xlab="Weight", ylab="", grid=F)
rec4 <- recordPlot()
plot_grid(rec1, rec2, rec3, rec4,
labels = "AUTO",
hjust = 0, vjust = 1)