I am plotting data showing the water surface elevation of a creek over a 16-year time span. The data are provided in 15-minute increments, but there are missing time periods, including one that lasted nearly two years.
I want to plot the data and to use axvspan (or a similar function) to highlight periods of missing data that lasted more than 120 minutes. I imagine a graph that looks something like this:
You can replicate the data using the following code:
import dataretrieval.nwis as nwis
import pandas as pd
import matplotlib.pyplot as plt
start_date = '2008-01-01'
end_date = '2024-04-01'
df = nwis.get_record(sites='02486100', service='iv', start=start_date, end=end_date)
df.rename(columns = {"00060":"Flow rate","00065":"Stage"}, inplace=True)
df = df.tz_convert('US/Central')
1