I am trying to plot this dataset using ggplot2: df <- data.frame( sid = c(rep('11',30),rep('22',30)), time = rep(ISOdate(year = 2010, month = 1, day = 1:30),2), sales = c(rnorm(30, 1000, 20),rnorm(30, 900, 10)), price = c(rnorm(30, 2, 0.5),rnorm(30, 3,0.5)) )
Plotting just the sales can be done easily: ggplot(data=df, aes(x=time, y=sales, group=sid, color=sid)) + geom_line(size=1) How can I plot the price (using geom_point) in a separate plot just above the sales plot so that the xaxes match and the yaxes are different. Or is there a better way? Thanks. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.