5.11.1.2. eqcorrscan.utils.plotting.cumulative_detections¶
-
eqcorrscan.utils.plotting.
cumulative_detections
(dates=None, template_names=None, detections=None, plot_grouped=False, group_name=None, rate=False, show=True, plot_legend=True, ax=None, save=False, savefile=None)[source]¶ Plot cumulative detections or detecton rate in time.
Simple plotting function to take a list of either datetime objects or
eqcorrscan.core.match_filter.Detection
objects and plot a cumulative detections list. Can take dates as a list of lists and will plot each list separately, e.g. if you have dates from more than one template it will overlay them in different colours.Parameters: - dates (list) – Must be a list of lists of datetime.datetime objects
- template_names (list) – List of the template names in order of the dates
- detections (list) – List of
eqcorrscan.core.match_filter.Detection
- plot_grouped (bool) – Plot detections for each template individually, or group them all together - set to False (plot template detections individually) by default.
- rate (bool) – Whether or not to plot the rate of detection per day. Only works for plot_grouped=True
- show (bool) – Whether or not to show the plot, defaults to True.
- plot_legend (bool) – Specify whether to plot legend of template names. Defaults to True.
- save (bool) – Save figure or show to screen, optional
- savefile (str) – String to save to, required is save=True
Returns: Note
Can either take lists of
eqcorrscan.core.match_filter.Detection
objects directly, or two lists of dates and template names - either/or, not both.Example
>>> import datetime as dt >>> import numpy as np >>> from eqcorrscan.utils.plotting import cumulative_detections >>> dates = [] >>> for i in range(3): ... dates.append([dt.datetime(2012, 3, 26) + dt.timedelta(n) ... for n in np.random.randn(100)]) >>> cumulative_detections(dates, ['a', 'b', 'c'], ... show=True)
(Source code, png, hires.png)
Example 2: Rate plotting
>>> import datetime as dt >>> import numpy as np >>> from eqcorrscan.utils.plotting import cumulative_detections >>> dates = [] >>> for i in range(3): ... dates.append([dt.datetime(2012, 3, 26) + dt.timedelta(n) ... for n in np.random.randn(100)]) >>> cumulative_detections(dates, ['a', 'b', 'c'], plot_grouped=True, ... rate=True, show=True)
(Source code, png, hires.png)