Plot trigger times on a dayplot

How can I add trigger times to a dayplot? The documentation says to give it a list of events as a list of dictionaries.

I obtained the trigger list like this:

cft = classic_sta_lta(tr.data, int(staSecondsdf), int(ltaSecondsdf))
trigList = trigger_onset(cft, thresOn, thresOf, max_len=9e+99, max_len_delete=False)

But I can’t work out how to pass this to st.plot.

The trigger onset function gives you “time” in terms of number of samples into the data, so you have to convert that back to actual time again. So something like the following based on your code snippet

events = []
for on, off in trigList:
    t = tr.stats.starttime + tr.stats.delta * on
    events.append({'time': t, 'text': ''})
tr.plot(type="dayplot", events=events)

Fantastic, thanks. I’m slowly getting the hang of this.