Еще один вариант получения подобного сюжета можно получить с помощью пакета cowplot
. Вот пример использования набора данных mtcars.
library(cowplot)
library(ggplot2)
#Create first plot
p1<-ggplot(mtcars, aes(x = mpg,
y = disp)) +
geom_point()
#Create second plot
p2<-ggplot(mtcars, aes(x = mpg,
y = hp)) +
geom_point()+
#Remove x axis ticks, title and text
theme(axis.text.x = element_blank(),
axis.ticks.x = element_blank(),
axis.title.x = element_blank())
#Create a canvas and draw the two plots with different sizes.
#x and y define the plot's lower left corner where each plot will be set (0-1)
# width and height can be interpreted as the proportion (0-1) of the original
#plot to be used to draw each plot
p3<-ggdraw()+
draw_plot(p1,x=0,y=0,width=1,height=0.7)+
draw_plot(p2,x=0,y=0.7,width=1,height=0.3)
p3