library(openxlsx) library(ggplot2) library(gridExtra) sample1<-read.xlsx("http://kanggc.iptime.org/book/data/sample1-n.xlsx") year<-sample1$year gdp<-sample1$gdp consumption<-sample1$consumption gdp consumption plot1<-qplot(gdp, consumption, geom="auto") plot2<-ggplot(data=sample1, aes(x=gdp, y=consumption)) + geom_point(colour="red", size=2) + ggtitle("Scatter plot of GDP and Consumption")+ theme(plot.title = element_text(hjust = 0.5)) marrangeGrob(grobs=list(plot1, plot2), nrow=2, ncol=1)