def plot_sample_rate_compare(data_dict, file_name=None):
    """
    -----
    Brief
    -----
    Is a plotting function that shows a sequence of ECG plots, demonstrating the relevance of
    choosing a wright sampling rate.

    -----------
    Description
    -----------
    Function intended to generate a Bokeh figure with Nx2 format, being N the number of keys of
    'data_dict' - one for each sampling rate (10, 100, 1000 Hz).

    At the first column is plotted a 10 seconds segment of the ECG signal at a specific
    sampling rate, while in the second column it will be presented a zoomed section of the ECG
    signal with 1 second, in order to the see the effect of choosing a specific sampling rate.

    Applied in the Notebook titled "Problems of a smaller sampling rate (aliasing)".

    ----------
    Parameters
    ----------
    data_dict : dict
        Dictionary that contains the data to be plotted
        ({"<sampling_rate_1>": {"time": <time_axis_1>, "data": <data_1>},
          "<sampling_rate_2>": {"time": <time_axis_2>, "data": <data_2>},
          ...})

    file_name : str
        Path containing the destination folder where the Bokeh figure will be stored.

    """

    # Generation of the HTML file where the plot will be stored.
    #file_name = _generate_bokeh_file(file_name)

    nbr_rows = len(list(data_dict.keys()))

    # List that store the figure handler.
    list_figures = plot([[]] * nbr_rows * 2, [[]] * nbr_rows * 2, y_axis_label="Raw Data",
                        x_axis_label="Time (s)", grid_lines=nbr_rows, grid_columns=2,
                        grid_plot=True, get_fig_list=True, show_plot=False)

    # Generation of Bokeh Figures.
    grid_list = []
    for iter, sample_rate in enumerate(list(data_dict.keys())):
        # List of figures in a valid gridplot format (each entry will define a row and each
        # subentry a column of the gridplot)
        grid_list += [[]]

        # Plotting of 10 seconds segment.
        # [Figure tile]
        title_unzoom = Title()
        title_unzoom.text = 'Sampling Rate: ' + sample_rate + " Hz"
        list_figures[2 * iter].title = title_unzoom

        # [Plot generation]
        list_figures[2 * iter].line(data_dict[sample_rate]["time"][:10 * int(sample_rate)],
                                    data_dict[sample_rate]["data"][:10 * int(sample_rate)],
                                    **opensignals_kwargs("line"))

        # Storage of customized figure.
        grid_list[-1] += [list_figures[2 * iter]]

        # Plotting of a zoomed section with 1 second.
        # [Figure tile]
        title_zoom = Title()
        title_zoom.text = 'Zoomed section @ ' + sample_rate + " Hz"
        list_figures[2 * iter + 1].title = title_zoom

        # [Plot generation]
        list_figures[2 * iter + 1].line(data_dict[sample_rate]["time"][:int(sample_rate)],
                                        data_dict[sample_rate]["data"][:int(sample_rate)],
                                        **opensignals_kwargs("line"))

        # Storage of customized figure.
        grid_list[-1] += [list_figures[2 * iter + 1]]

    # Organisation of figures in a gridplot.
    grid_plot_1 = gridplot(grid_list, **opensignals_kwargs("gridplot"))

    # Show representations.
    show(grid_plot_1)
def plot_sample_rate_compare ( data_dict , file_name = None ) : nbr_rows = len ( list ( data_dict . keys ( ) ) ) list_figures = plot ( [ [ ] ] * nbr_rows * 2 , [ [ ] ] * nbr_rows * 2 , y_axis_label = "Raw Data" , x_axis_label = "Time (s)" , grid_lines = nbr_rows , grid_columns = 2 , grid_plot = True , get_fig_list = True , show_plot = False ) grid_list = [ ] for iter , sample_rate in enumerate ( list ( data_dict . keys ( ) ) ) : grid_list += [ [ ] ] title_unzoom = Title ( ) title_unzoom . text = 'Sampling Rate: ' + sample_rate + " Hz" list_figures [ 2 * iter ] . title = title_unzoom list_figures [ 2 * iter ] . line ( data_dict [ sample_rate ] [ "time" ] [ : 10 * int ( sample_rate ) ] , data_dict [ sample_rate ] [ "data" ] [ : 10 * int ( sample_rate ) ] , ** opensignals_kwargs ( "line" ) ) grid_list [ - 1 ] += [ list_figures [ 2 * iter ] ] title_zoom = Title ( ) title_zoom . text = 'Zoomed section @ ' + sample_rate + " Hz" list_figures [ 2 * iter + 1 ] . title = title_zoom list_figures [ 2 * iter + 1 ] . line ( data_dict [ sample_rate ] [ "time" ] [ : int ( sample_rate ) ] , data_dict [ sample_rate ] [ "data" ] [ : int ( sample_rate ) ] , ** opensignals_kwargs ( "line" ) ) grid_list [ - 1 ] += [ list_figures [ 2 * iter + 1 ] ] grid_plot_1 = gridplot ( grid_list , ** opensignals_kwargs ( "gridplot" ) ) show ( grid_plot_1 )
-----
    Brief
    -----
    Is a plotting function that shows a sequence of ECG plots, demonstrating the relevance of
    choosing a wright sampling rate.

    -----------
    Description
    -----------
    Function intended to generate a Bokeh figure with Nx2 format, being N the number of keys of
    'data_dict' - one for each sampling rate (10, 100, 1000 Hz).

    At the first column is plotted a 10 seconds segment of the ECG signal at a specific
    sampling rate, while in the second column it will be presented a zoomed section of the ECG
    signal with 1 second, in order to the see the effect of choosing a specific sampling rate.

    Applied in the Notebook titled "Problems of a smaller sampling rate (aliasing)".

    ----------
    Parameters
    ----------
    data_dict : dict
        Dictionary that contains the data to be plotted
        ({"<sampling_rate_1>": {"time": <time_axis_1>, "data": <data_1>},
          "<sampling_rate_2>": {"time": <time_axis_2>, "data": <data_2>},
          ...})

    file_name : str
        Path containing the destination folder where the Bokeh figure will be stored.