0

My question is about overlaying plots of different x and y scales .The raw data is out of a public weather database in New Zealand called CliFlo, managed by NIWA. I'm not prepared to copy the data for an example because of copyright protections.

I want to reproduce the types of graphs they offer at a fee, shown on this web page. Take the Rainfall graph. There is a cumulative rainfall line graph overlayed on top of a monthly rainfall bar graph. I can generate each graph separately using ggplot2, but I can't find a good way to overlay them like in the example. I've found the gridExtra package to let me print them side-by-side, and I've come across the magick package that might let me do the job, but I'm not sure on how to get the plots lined up properly and how to use the magick package properly. Can anybody help me out on this?

Should I try to scale the month bars to fit the daily line graph but make them spaced out and thicker so they look like months, or would it be easier to use the magick package somehow?

I'd attach an image of what I have so far, but I'm new to this website and it won't let me yet.

lobati
  • 9,284
  • 5
  • 40
  • 61
S-Can
  • 23
  • 4
  • 1
    Like this https://stackoverflow.com/a/47169132/786542? – Tung Aug 12 '18 at 23:19
  • Also take a look at [highcharter](https://rpubs.com/mr148/304105) – Tung Aug 12 '18 at 23:20
  • https://www.highcharts.com/demo/combo-meteogram#https://www.yr.no/place/United_Kingdom/England/London/forecast_hour_by_hour.xml & https://www.highcharts.com/demo/combo-multi-axes – Tung Aug 12 '18 at 23:20
  • All of the above comments contain examples of multiple Y-AXES, I am asking for multiple X-AXES as well as multiple Y-AXES. Having a secondary y-axis is simple, just scale the graphs to fit on the same vertical length and add a secondary y-axis. Fitting two different X-AXES, however, is not supported by ggplot2 because of philosophical disagreement. Unfortunately, many users prefer the multiple x-axis overlay. I need DAILY line graphs overlaid on top of MONTHLY bar graphs, not monthly lines on top of monthly bars. That's my issue. Thanks for the suggestions though. – S-Can Aug 13 '18 at 01:23

0 Answers0