# How to count the number of triggers in a plot?

**URL:** <https://discourse.obspy.org/t/how-to-count-the-number-of-triggers-in-a-plot/1590>\
**Category:** Usage Questions\
**Created:** [December 14, 2022, 4:59pm UTC](https://discourse.obspy.org/t/how-to-count-the-number-of-triggers-in-a-plot/1590 "2022-12-14T16:59:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adarsh\_P](https://discourse.obspy.org/user_avatar/discourse.obspy.org/adarsh_p/32/624_2.png) [@Adarsh\_P](https://discourse.obspy.org/u/Adarsh_P)\
**Post date:** [December 14, 2022, 4:59pm UTC](https://discourse.obspy.org/t/how-to-count-the-number-of-triggers-in-a-plot/1590/1 "2022-12-14T16:59:58Z")

</div>

![image](https://discourse.obspy.org/uploads/default/original/1X/d52609c073b56bb3338a5cb7806cc9c206019b26.png)

**#Shown above here is my plot using my own data. How can I get the number of triggers from the plot? (Visually it’s 10, how to get the count of triggers). Also how can I segment each trigger events separately?**

---

<div class="post-metadata">

**Author:** ![megies](https://discourse.obspy.org/user_avatar/discourse.obspy.org/megies/32/9_2.png) [@megies](https://discourse.obspy.org/u/megies)\
**Post date:** [December 15, 2022, 9:05am UTC](https://discourse.obspy.org/t/how-to-count-the-number-of-triggers-in-a-plot/1590/2 "2022-12-15T09:05:44Z")

</div>

Put your characteristic function you get out of the trigger routine into this function:

> **[obspy.signal.trigger.trigger\_onset — ObsPy...](https://docs.obspy.org/master/packages/autogen/obspy.signal.trigger.trigger_onset.html)**

---

<div class="post-metadata">

**Author:** ![Adarsh\_P](https://discourse.obspy.org/user_avatar/discourse.obspy.org/adarsh_p/32/624_2.png) [@Adarsh\_P](https://discourse.obspy.org/u/Adarsh_P)\
**Post date:** [December 15, 2022, 1:53pm UTC](https://discourse.obspy.org/t/how-to-count-the-number-of-triggers-in-a-plot/1590/3 "2022-12-15T13:53:47Z")

</div>

Thanks a lot! @megies
