'How to create a plot that summarizes multiple daily profiles?

I am a type 1 diabetic and wear a continuous glucose monitor that measures my blood glucose levels every 5 minutes. The company that makes the CGM generates a report with a graph that looks like the figure at the bottom of this post. My goal is to learn how to recreate this graph for myself in a Jupyter notebook.

The data that I have, for example, looks like this:

Timestamp Glucose Value (mg/dL)
2021-07-11 00:11:25 116.0
2021-07-11 00:16:25 118.0
2021-07-11 00:21:25 121.0
2021-07-11 00:26:24 123.0
2021-07-11 00:31:25 124.0

The graph is using data from a 30 day period and summarizing the distribution of values at each point in time. Is there a name for this type of graph, and how can I create it myself using Pandas/matplotlib/seaborn?

So far, I have tried creating a graph with the IQR split by day which is rather easy - using ploty:

glucose['Day'] = glucose['Timestamp'].dt.day_name()

fig = px.box(glucose, x="Day", y="Glucose Value (mg/dL)",
         points="all", color='Day')
fig.show()

But now I am unsure how to easily calculate the IQR for specific time periods and average them.

Thank you so much for your help!

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source