[R] Overlay line on a bar plot - multiple axis

Ron Crump r@e@crump @end|ng |rom w@rw|ck@@c@uk
Mon Apr 30 12:28:31 CEST 2018


Hi Miluji,

Using Jim's interpretation of your desired graph,
you could do it in ggplot2 using your dat DF by:

ggplot() +
  geom_bar(data=dat,
    aes(x=week,y=count,fill=city),stat="identity",position="dodge") +
  coord_flip() +
  geom_line(data=dat, aes(x=week, y=mean_tmin))

There would still need some work to be done to get the weekly mean
into a legend, but it is achievable if required.

Ron.




More information about the R-help mailing list