-----
    Brief
    -----
    With this plotting function it will be possible to demonstrate which "peaks" are being
    detected in each stage of Pan-Tompkins Algorithm (possible, probable, definitive).

    -----------
    Description
    -----------
    Function intended to generate a Bokeh figure containing all peaks detected in a temporal
    segment (of ECG integrated signal) with 2 seconds.

    "Possible Peaks" are marked with the smallest circle while "Probable Peaks" and "Definitive
    Peaks" are highlighted with medium and large size circles.

    Applied in the Notebook titled "Event Detection - R Peaks (ECG)".

    ----------
    Parameters
    ----------
    time : list
        List containing the time-axis sequence of values.

    orig_ecg : list
        Sequence of sampled values (Original ECG).

    integrated_ecg : list
        Sequence of sampled values (Integrated ECG).

    sampling_rate : int
        Acquisition sampling rate (Hz)

    possible_peaks : list
        List containing all "Possible Peaks" detected from Pan-Tompkins R Peak Detection
        Algorithm.

    probable_peaks : list
        List containing all "Probable Peaks" detected from Pan-Tompkins R Peak Detection
        Algorithm.

    definitive_peaks : list
        List containing all "Definitive Peaks" detected from Pan-Tompkins R Peak Detection
        Algorithm.

def plot_ecg_pan_tompkins_peaks(time, orig_ecg, integrated_ecg, sampling_rate, possible_peaks,
                                probable_peaks, definitive_peaks):
    """
    -----
    Brief
    -----
    With this plotting function it will be possible to demonstrate which "peaks" are being
    detected in each stage of Pan-Tompkins Algorithm (possible, probable, definitive).

    -----------
    Description
    -----------
    Function intended to generate a Bokeh figure containing all peaks detected in a temporal
    segment (of ECG integrated signal) with 2 seconds.

    "Possible Peaks" are marked with the smallest circle while "Probable Peaks" and "Definitive
    Peaks" are highlighted with medium and large size circles.

    Applied in the Notebook titled "Event Detection - R Peaks (ECG)".

    ----------
    Parameters
    ----------
    time : list
        List containing the time-axis sequence of values.

    orig_ecg : list
        Sequence of sampled values (Original ECG).

    integrated_ecg : list
        Sequence of sampled values (Integrated ECG).

    sampling_rate : int
        Acquisition sampling rate (Hz)

    possible_peaks : list
        List containing all "Possible Peaks" detected from Pan-Tompkins R Peak Detection
        Algorithm.

    probable_peaks : list
        List containing all "Probable Peaks" detected from Pan-Tompkins R Peak Detection
        Algorithm.

    definitive_peaks : list
        List containing all "Definitive Peaks" detected from Pan-Tompkins R Peak Detection
        Algorithm.
    """

    # List that store the figure handler
    list_figures = []

    # Plotting of a signal segment with 2 seconds
    segment_data = numpy.array(orig_ecg[:2 * sampling_rate])
    segment_int = numpy.array(integrated_ecg[:2 * sampling_rate])
    segment_time = numpy.array(time[:2 * sampling_rate])

    # Peaks list for the 2 seconds window
    possible_peaks_wind = numpy.array(possible_peaks)[numpy.array(possible_peaks) < len(segment_int)]
    probable_peaks_wind = numpy.array(probable_peaks)[numpy.array(probable_peaks) < len(segment_int)]
    definitive_peaks_wind = numpy.array(definitive_peaks)[numpy.array(definitive_peaks) < len(segment_int)]

    list_figures.append(figure(x_axis_label='Time (s)', y_axis_label='Raw Data', **opensignals_kwargs("figure")))
    list_figures[-1].line(segment_time, segment_int, **opensignals_kwargs("line"))
    list_figures[-1].circle(segment_time[definitive_peaks_wind], segment_int[definitive_peaks_wind], size=30, color="#00893E", legend="Definitive Peaks")
    list_figures[-1].circle(segment_time[probable_peaks_wind], segment_int[probable_peaks_wind], size=20, color="#009EE3", legend="Probable Peaks")
    list_figures[-1].circle(segment_time[possible_peaks_wind], segment_int[possible_peaks_wind], size=10, color="#302683", legend="Possible Peaks")

    # Show figure.
    opensignals_style(list_figures)
    show(list_figures[-1])