I am interested in creating one overall graph that contains both a bar graph and line graph, with each on separate Y axes. For example, I have weather data containing both historic (1990-2013) and current (2014) data for precipitation and temperature at my study site. I would like to plot the historic vs. current precipitation data as a bar graph, and then also plot historic vs. current temperature data as a line graph, all within the same graph. The precipitation Y axis ranges from 0-150, while the temperature y axis ranges from 0-20. I have been able to plot the first graph (precipitation bar graph) with no problem. I am at a lose as to how I would then graph the temperature line graph over the bar graph? Any help would be much appreciated. Below is the code for my bar graph.
precip.bar <- ggplot(data=weather, aes(x=Date, y=Precip, fill=Period))+
geom_bar(position="dodge", colour="black", stat="identity", width=1)+
scale_fill_manual(values=c("#000000", "#D3D3D3"))+
xlab("Date") + ylab("Precipitation (mm)") +
ggtitle("Slug Creek SNOWTEL Data") +
theme_bw()
precip.bar