Suppose I have the following datasets:
The first one is monthly data:
library (ggplot2)
val <- runif(48, -5,5)
dt <- seq(as.Date("2010/1/1"), by = "month", length.out = 48)
dat <- data.frame(cbind(val, as.Date(dt)))
ggplot(dat, aes(dt, val,fill=val)) + geom_bar(stat = 'identity')
The second is annual data with different y scale:
val2 <- runif(4,50,70)
dt2 <- seq(2010,2014)
dat2 <- data.frame(cbind(val2, dt2))
Is it possible to overlay the 2nd dataset on this plot, having two y axis but one x axis?