0

This question was deleted before on the premise that it was a duplicate. However, the question I am asking is different from the ones previously posed in that I'm not only asking about how to plot minima but also about how to do this below a certain cut-off or threshold value.

I have a dataset in a pandas dataframe that looks like this:

code   HR
1      80
1      92
1      76
.      .
.      .
.      .
60    114

Each patient (corresponding to a unique code) has 50 data points (corresponding to 50 consecutive hours post medical procedure), and I've created plots outlining heart rate (HR) over those 50 hours as such:

pt_code= np.unique(df.id.values)
fig,axes = plt.subplots(30,2)
ax = axes.flatten()
index = 0 
for id in ids:
    subset = df.HR[df["ids"]==id]
    flt[index].plot(subset.values)
    index=index+1
plt.show()

However, I want to annotate local minimums below a certain threshold (an HR of 40). So I want to end up with plots where all minima below 65 beats per minute are highlighted in each of the plots. Is this possible? If so how can I go about doing it?

ummendial
  • 83
  • 9
  • Which part are you having trouble with finding the minimums or the annotation? Welcome to SO. This isn't a discussion forum or tutorial. Please take the [tour] and take the time to read [ask] and the other links found on that page. – wwii Apr 08 '21 at 17:53
  • Thanks will go over these links. The part I'm having trouble with is finding the minimums below a certain value/threshold of (y). – ummendial Apr 08 '21 at 18:09

0 Answers0