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?
