How to plot a line graph with highlighted time periods on time series graph

33 Views Asked by At

I have two datasets, rainfall and datetimes (durations) for when an event had occurred, both measurements were taken in 2020.

I want to plot them both on the same graph, with rainfall as a line with a Y axis spanning from 0-10mm and X axis as the date (in datetime format - which correlates to the 'event occurring' dataset).

How do I plot the second dataset on this graph as shaded rectangles representing the duration they occurred?

See image for visualisation aim:

Visualisation aim

I have the rainfall plotted, however, need to change the X axis to datetime using the second dataset that has time included as well (although the rainfall data doesn't have time included so I'd just go by the start of the day).

Rainfall plot so far:

Rainfall plot so far

0

There are 0 best solutions below