As others have said, reproducibility simplifies answering questions. However, this is a question that can be easily answered by the general case.
ggplot2 offers several limited options for multiple plots on a single plate. The R Cookbook offers a pretty good and very easy to use workaround here . I can quickly guide you through this for your business:
First, some two simple sets of time series in a data frame:
year<-c(2010:2014)
data1<-c(1:5)
data2<-c(20:24)
df<-data.frame(year,data1,data2)
. , x, :
library(ggplot2)
p1<-qplot(data=df,x=year,y=data1)+theme(axis.title.x = element_blank(), axis.text.x = element_blank())
p2<-qplot(df,x=year,y=data2)
, :
multiplot <- function(..., plotlist = NULL, file, cols = 1, layout = NULL) {
require(grid)
plots <- c(list(...), plotlist)
numPlots = length(plots)
if (is.null(layout)) {
layout <- matrix(seq(1, cols * ceiling(numPlots/cols)), ncol = cols,
nrow = ceiling(numPlots/cols))
}
if (numPlots == 1) {
print(plots[[1]])
} else {
grid.newpage()
pushViewport(viewport(layout = grid.layout(nrow(layout), ncol(layout))))
for (i in 1:numPlots) {
matchidx <- as.data.frame(which(layout == i, arr.ind = TRUE))
print(plots[[i]], vp = viewport(layout.pos.row = matchidx$row, layout.pos.col = matchidx$col))
}
}
}
... , .
multiplot(p1,p2,cols=1)
( , , , ! , .)
, ?