5.10.1.2. eqcorrscan.utils.plotting.cumulative_detections¶
-
eqcorrscan.utils.plotting.
cumulative_detections
(dates=None, template_names=None, detections=None, plot_grouped=False, show=True, plot_legend=True, save=False, savefile=None)[source]¶ Plot cumulative detections in time.
Simple plotting function to take a list of datetime 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.
- 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: class: matplotlib.figure Note
Can either take lists of 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)