Пример #1
0
    plot_congestion_scatter(["TempAvg"], ["SpatAvg"], arbis_matched, plot_path,
                            file_prefix, save_plot, show_plot)

    plot_congestion_scatter(["TempDist"], ["SpatDist"], arbis_matched,
                            plot_path, file_prefix, save_plot, show_plot)

    plot_congestion_scatter(["TLCar"], ["TLHGV"], arbis_matched, plot_path,
                            file_prefix, save_plot, show_plot)

    ##################
    ### Histograms ###
    ##################

    # Plot histogram of roadworks over time / months
    plt.figure(figsize=set_size(418, 1.8))
    plt.style.use('seaborn')
    plt.rcParams.update(tex_fonts)
    plt.title(
        'Histogram of roadwork per month, with at least one adjacent congestion'
    )
    plt.ylabel('Count')
    plt.xlabel('Month of 2019')
    sns.countplot(x='Month',
                  data=arbis_matched,
                  palette='Spectral',
                  order=months)
    if save_plot:
        plt.savefig(plot_path + file_prefix + '_hist_month.pdf')
        if not show_plot:
            plt.close()
        plt.savefig(plot_path + file_prefix + '_hist_highway.pdf')
        if not show_plot:
            plt.close()
    if show_plot:
        plt.show()
    else:
        plt.close()

    ##############
    ### Counts ###
    ##############

    # Multi plots

    scale = 1.0
    (width, height) = set_size(418, scale)

    fig, axs = plt.subplots(4, 1, figsize=(width, 3.5 * height))
    plt.style.use('seaborn')
    plt.rcParams.update(tex_fonts)
    sns.countplot(ax=axs[0], x='Kat', data=baysis_selected, palette='Spectral')
    sns.countplot(ax=axs[1], x='Typ', data=baysis_selected, palette='Spectral')
    sns.countplot(ax=axs[2],
                  x='Betei',
                  data=baysis_selected,
                  palette='Spectral')
    atr = 'UArt'
    concat = pd.concat(
        [baysis_selected[atr + '1'], baysis_selected[atr + '2']], keys=[atr])
    sns.countplot(ax=axs[3], x=atr, data=concat, palette='Spectral')
    if save_plot:
Пример #3
0
    plot_congestion_scatter(["TempExMax"], ["SpatExMax"], arbis_matched,
                            plot_path, file_prefix, save_plot, show_plot)

    plot_congestion_scatter(["TempDist"], ["SpatDist"], arbis_matched,
                            plot_path, file_prefix, save_plot, show_plot)

    plot_congestion_scatter(["TimeLossCar"], ["TimeLossHGV"], arbis_matched,
                            plot_path, file_prefix, save_plot, show_plot)

    locators = [
        "temporalGlobalLoc", "spatialGlobalLoc", "temporalInternalLoc",
        "spatialInternalLoc"
    ]

    for atr in locators:
        plt.figure(figsize=set_size(418, 0.8))
        plt.style.use('seaborn')
        plt.rcParams.update(tex_fonts)
        plt.title('Distribution of ' + atr)
        plt.ylabel('Count')
        arbis_matched.plot.scatter(x='TempExMax',
                                   y='SpatExMax',
                                   c=atr,
                                   colormap='viridis')
        plt.xlabel(atr)
        if save_plot:
            plt.savefig(plot_path + file_prefix + '_scatter_E_' + atr + '.pdf')
            if not show_plot:
                plt.close()
        if show_plot:
            plt.show()