Beispiel #1
0
def plot_data(total_results):
    fig = plt.figure()

    x_tcp = total_results["tcp-throughput"][0]
    y_tcp = total_results["tcp-throughput"][1]

    x_tcp_tls = total_results["tcp-tls-throughput"][0]
    y_tcp_tls = total_results["tcp-tls-throughput"][1]

    x_udp = total_results["udp-throughput"][0]
    y_udp = total_results["udp-throughput"][1]

    x_quic = total_results["quic-throughput"][0]
    y_quic = total_results["quic-throughput"][1]

    plt.plot(x_tcp, y_tcp, 'b-', label="TCP")
    plt.plot(x_tcp_tls, y_tcp_tls, 'g-', label="TCPTLS")
    plt.plot(x_udp, y_udp, 'y-', label="UDP")
    plt.plot(x_quic, y_quic, 'r-', label="QUIC")

    plt.ylabel('Throughput [KBits/s]')
    plt.xlabel('rate [KBit/s]')

    # TODO: depending on the tick_interval we could round to the next 10s, 100s cont.
    # i.e. round(97, -1) => 100, round(970, -2) => 1000 ...
    tick_interval = round((max(x_quic) - min(x_quic)) / 10, -1)
    plt.xticks(np.arange(min(x_tcp), max(x_tcp) + tick_interval, tick_interval))
    plt.legend()

    result_file = shared.prepare_result(os.path.basename(__file__)[:-3])
    fig.savefig(result_file, bbox_inches='tight')
Beispiel #2
0
def plot_data(total_results):
    fig = plt.figure()

    x_tcp = total_results["tcp-throughput"][0]
    y_tcp = total_results["tcp-throughput"][1]

    x_tcp_tls = total_results["tcp-tls-throughput"][0]
    y_tcp_tls = total_results["tcp-tls-throughput"][1]

    # print(x_tcp)
    # print(y_tcp)

    x_udp = total_results["udp-throughput"][0]
    y_udp = total_results["udp-throughput"][1]

    x_quic = total_results["quic-throughput"][0]
    y_quic = total_results["quic-throughput"][1]

    plt.plot(x_tcp, y_tcp, 'b-', label="TCP")
    plt.plot(x_tcp_tls, y_tcp_tls, 'g-', label="TCPTLS")
    plt.plot(x_udp, y_udp, 'y-', label="UDP")
    plt.plot(x_quic, y_quic, 'r-', label="QUIC")

    plt.ylabel('Throughput [MBits/s]')
    plt.xlabel('cores [#]')

    plt.xticks(np.arange(min(x_tcp), max(x_tcp) + 1, 1.0))
    plt.legend()

    result_file = shared.prepare_result(os.path.basename(__file__)[:-3])
    fig.savefig(result_file, bbox_inches='tight')
def plot_data_bar_plot(quic_result, tls_result, tcp_result):
    print("\n\nquic res: ", quic_result)
    print("\n\ntcp res: ", tcp_result)

    # CHANGES THE SPACE BETWEEN CLUSTERS
    # the x locations for the groups
    ind = np.arange(0, len(quic_result) * 0.25, 0.25)
    # width = 0.35  # the width of the bars
    width = 0.05  # the width of the bars

    fig = plt.figure(figsize=(15, 10))
    ay1 = plt.subplot(211)
    rects_quic = plt.bar(ind - 3.5 * width/3, quic_result,
                         width, color='#ff7f00', label='QUIC')
    rects_tls = plt.bar(ind, tls_result, width,
                        color='#4daf4a', label='TCP/TLS')
    rects_tcp = plt.bar(ind + 3.5 * width/3, tcp_result,
                        width, color='#377eb8', label='TCP')

    plt.ylabel('Goodput/rate [%]', fontsize=15)
    plt.xticks(ind)
    ay1.set_xticklabels(('2 % mean-PER', '5 % mean-PER',
                         '10 % mean-PER', '20 % mean-PER'), fontsize=15)
    plt.yticks(yticks_list)
    #plt.xlabel(('500', '250', '50'), fontsize=15)
    # plt.legend()
    legend = plt.legend()
    frame = legend.get_frame()
    frame.set_facecolor('white')

    # we dont need that plt.gca().invert_xaxis()
    plt.grid(color='darkgray', linestyle=':')

    autolabel(ay1, rects_quic, "left")
    autolabel(ay1, rects_tls, "center")
    autolabel(ay1, rects_tcp, "right")

    plt.subplots_adjust(hspace=0.5)

    plt.grid(color='darkgray', linestyle=':')
    # plt.box(on=True)
    ax = plt.gca()
    ax.set_facecolor('white')
    plt.setp(ax.spines.values(), color='black')

    msmt_name = os.path.basename(__file__)[:-3]
    result_file = shared.prepare_result(msmt_name)
    # fig.suptitle(r'Rate limitation: Critical threshold analysis \n (Steps = 4, Iterations = 4, $\alpha_i > \beta_i$)', fontsize=14)
    # fig.suptitle("Measurement module: Loss analysis\n {}".format(r'(Rate steps = 4, Loss steps = 4,  Iterations = 4, $t_{deadline} = 60s$)'), fontsize=14)
    #fig.suptitle("Summary: Independent, random loss for 500 KBit/s\n")

    fig.savefig(result_file, bbox_inches='tight')
Beispiel #4
0
def plot_data(total_results):
    fig = plt.figure()

    x_tcp = total_results["tcp-throughput"][0]
    y_tcp = total_results["tcp-throughput"][1]

    x_tcp_tls = total_results["tcp-tls-throughput"][0]
    y_tcp_tls = total_results["tcp-tls-throughput"][1]

    x_quic = total_results["quic-throughput"][0]
    y_quic = total_results["quic-throughput"][1]

    plt.plot(x_tcp, y_tcp, linestyle=':', marker='v', markersize=4, color='#377eb8', label="TCP")
    plt.plot(x_tcp_tls, y_tcp_tls, linestyle='-.', marker='^', markersize=4, color='#4daf4a', label="TCPTLS")
    plt.plot(x_quic, y_quic, linestyle=shared.linestyles['densely dashdotted'], marker='s', markersize=4, color='#984ea3', label="QUIC")

    plt.ylabel('reachability [%]')
    plt.xlabel('rate [KBit/s]')

    '''
    create tick intervals or use predefined list
    tick_interval = (max(x_quic) - min(x_quic)) / 10
    tick_interval_rounded = shared.round_xticks(tick_interval)

    # create ticks accordingly
    ticks = np.arange(min(x_tcp), max(x_tcp) + tick_interval_rounded, tick_interval_rounded)
    # debug print("created ticks: ", ticks)

    for tick in ticks:
        if len(str(tick)) >= 3:
            tick_index = np.where(ticks == tick)
            tick_rounded = round(tick, -2)
            ticks[tick_index] = tick_rounded
    
    
    # plt.xticks(ticks)
    '''

    plt.xticks(analyzing_rates)
   
    plt.legend()
    plt.gca().invert_xaxis()
    plt.grid(color='darkgray', linestyle=':')
    result_file = shared.prepare_result(os.path.basename(__file__)[:-3])
    fig.suptitle("Rate limitation: Large interval analysis\n {}".format(r'(Steps = 7, Iterations = 5, $t_{deadline} = 60s$)'), fontsize=10)
    fig.savefig(result_file, bbox_inches='tight')
def plot_data_bar_plot(quic_result, tls_result, tcp_result):
    print("\n\nquic res: ", quic_result)
    print("\n\ntls res: ", tls_result)
    print("\n\ntls res: ", tls_result)


    ind = np.arange(0, len(quic_result) * 0.25, 0.25)  # the x locations for the groups
    # width = 0.35  # the width of the bars
    width = 0.05  # the width of the bars

    fig = plt.figure(figsize=(15, 10))
    ay1 = plt.subplot(211) 

    print("\nquic result", quic_result)
    print("\ntcp result", tls_result)

    rects1 = plt.bar(ind - 3.5 * width/3, quic_result, width, color='#ff7f00', label="QUIC")
    rects2 = plt.bar(ind, tls_result, width, color='#4daf4a', label="TCP/TLS")
    rects3 = plt.bar(ind + 3.5 * width/3, tcp_result, width, color='#377eb8', label="TCP")



    plt.ylabel('Goodput/rate [%]', fontsize=15)
    plt.xticks(ind)

    ay1.set_xticklabels(('10 ms', '50 ms', '250 ms', '1000 ms'), fontsize=15)
    
    plt.yticks(yticks_list)
    # plt.xlabel(('500', '250', '50'), fontsize=15)
    plt.legend()
    # we dont need that plt.gca().invert_xaxis()
    plt.grid(color='darkgray', linestyle=':')
    autolabel(ay1, rects1, "left")
    autolabel(ay1, rects2, "center")
    autolabel(ay1, rects3, "right")

    ax = plt.gca()
    ax.set_facecolor('white')
    plt.setp(ax.spines.values(), color='black')
    legend = plt.legend()
    legend_frame = legend.get_frame()
    legend_frame.set_facecolor('white')
    plt.subplots_adjust(hspace = 0.5)
    msmt_name = os.path.basename(__file__)[:-3]
    result_file = shared.prepare_result(msmt_name)
    fig.savefig(result_file, bbox_inches='tight')
def plot_data_bar_plot(quic_result, tls_result, tcp_result):
    print("\n\nquic res: ", quic_result)
    print("\n\ntcp res: ", tcp_result)

    # CHANGES THE SPACE BETWEEN CLUSTERS
    ind = np.arange(0, len(quic_result) * 0.25, 0.25)  # the x locations for the groups
    # width = 0.35  # the width of the bars
    width = 0.05  # the width of the bars

    fig = plt.figure(figsize=(15, 10))
    ay1 = plt.subplot(211) 
    rects_quic = plt.bar(ind - 3.5 * width/3, quic_result, width, color='#ff7f00', label='QUIC')
    rects_tls = plt.bar(ind, tls_result, width, color='#4daf4a', label='TCPTLS')
    rects_tcp = plt.bar(ind + 3.5 * width/3, tcp_result, width, color='#377eb8', label='TCP')

    # r'(Steps = 23, Iterations = 10, $t_{deadline} = 60s$)'

    plt.ylabel('Goodput/rate [%]', fontsize=15)
    plt.xticks(ind)
    ay1.set_xticklabels(('50 {} / 2 {} / 3.84 % PER'.format(r'$pkts_{good}$', r'$pkts_{bad}$'), '50 {} / 4 {} / 7.40 % PER'.format(r'$pkts_{good}$', r'$pkts_{bad}$'), '50 {} / 8 {} / 13.79 % PER'.format(r'$pkts_{good}$', r'$pkts_{bad}$'), '50 {} / 16 {} / 24.24 % PER'.format(r'$pkts_{good}$', r'$pkts_{bad}$')), fontsize=10.8)
    plt.yticks(yticks_list)
    # plt.xlabel(('500', '250', '50'), fontsize=15)
    plt.legend()
    # we dont need that plt.gca().invert_xaxis()
    plt.grid(color='darkgray', linestyle=':')
    
    autolabel(ay1, rects_quic, "left")
    autolabel(ay1, rects_tls, "center")
    autolabel(ay1, rects_tcp, "right")

    ax = plt.gca()
    ax.set_facecolor('white')
    plt.setp(ax.spines.values(), color='black')
    legend = plt.legend()
    legend_frame = legend.get_frame()
    legend_frame.set_facecolor('white')



    plt.subplots_adjust(hspace = 0.5)
    msmt_name = os.path.basename(__file__)[:-3]
    result_file = shared.prepare_result(msmt_name)
    fig.savefig(result_file, bbox_inches='tight')
def plot_data(gp_avg):

    tcp_gp_avg_first_rate = gp_avg["tcp-throughput"][2][0]
    tcp_gp_avg_second_rate = gp_avg["tcp-throughput"][2][1]
    tcp_gp_avg_third_rate = gp_avg["tcp-throughput"][2][2]
    tcp_gp_avg_fourth_rate = gp_avg["tcp-throughput"][2][3]

    tls_gp_avg_first_rate = gp_avg["tcp-tls-throughput"][2][0]
    tls_gp_avg_second_rate = gp_avg["tcp-tls-throughput"][2][1]
    tls_gp_avg_third_rate = gp_avg["tcp-tls-throughput"][2][2]
    tls_gp_avg_fourth_rate = gp_avg["tcp-tls-throughput"][2][3]

    quic_gp_avg_first_rate = gp_avg["quic-throughput"][2][0]
    quic_gp_avg_second_rate = gp_avg["quic-throughput"][2][1]
    quic_gp_avg_third_rate = gp_avg["quic-throughput"][2][2]
    quic_gp_avg_fourth_rate = gp_avg["quic-throughput"][2][3]

    # one can also use the other protocols loss values.
    # also ensures different loss values => add ons for future
    first_rate_delay_values = gp_avg["tcp-throughput"][1][0]
    second_rate_delay_values = gp_avg["tcp-throughput"][1][1]
    third_rate_delay_values = gp_avg["tcp-throughput"][1][2]
    fourth_rate_delay_values = gp_avg["tcp-throughput"][1][3]

    fig = plt.figure(figsize=(11, 9))
    ay1 = plt.subplot(411)

    plt.plot(fourth_rate_delay_values,
             tcp_gp_avg_fourth_rate,
             linestyle=':',
             marker='v',
             markersize=4,
             color='#377eb8',
             label="TCP")
    plt.plot(fourth_rate_delay_values,
             tls_gp_avg_fourth_rate,
             linestyle='-.',
             marker='^',
             markersize=4,
             color='#4daf4a',
             label="TCP/TLS")
    plt.plot(fourth_rate_delay_values,
             quic_gp_avg_fourth_rate,
             linestyle=shared.linestyles['densely dashdotted'],
             marker='s',
             markersize=4,
             color='#ff7f00',
             label="QUIC")

    plt.ylabel('Goodput/rate [%]')
    plt.xlabel('delay [ms]', labelpad=0)
    plt.xticks(first_rate_delay_values)
    plt.yticks(yticks_list)
    plt.legend()
    plt.grid(color='darkgray', linestyle=':')
    plt.title('Rate: {} KBit/s'.format(gp_avg["tcp-throughput"][0][3]))

    ax = plt.gca()
    ax.set_facecolor('white')
    plt.setp(ax.spines.values(), color='black')

    legend = plt.legend(loc="best", bbox_to_anchor=(0.58, 0.7))
    legend_frame = legend.get_frame()
    legend_frame.set_facecolor('white')

    plt.arrow(250.0,
              0.6,
              0.0,
              0.05,
              fc="#e41a1c",
              ec="#e41a1c",
              head_width=3,
              head_length=0.1,
              label="NB-IoT 1")
    plt.annotate('NB-IoT \n(600 UEs, Suburban)',
                 xy=(250.0, 0.35),
                 ha='center',
                 fontsize=10,
                 color="#e41a1c")

    plt.arrow(50.0,
              0.6,
              0.0,
              0.05,
              fc="#e41a1c",
              ec="#e41a1c",
              head_width=3,
              head_length=0.1,
              label="NB-IoT 1")
    plt.annotate('NB-IoT \n(200 UEs, Urban)',
                 xy=(55.0, 0.35),
                 ha='center',
                 fontsize=10,
                 color="#e41a1c")

    plt.arrow(10.0,
              0.8,
              0.0,
              0.05,
              fc="#e41a1c",
              ec="#e41a1c",
              head_width=3,
              head_length=0.1,
              label="NB-IoT 1")
    plt.annotate('LTE-M \n(200 UEs, Urban)',
                 xy=(10.0, 0.5),
                 ha='center',
                 fontsize=10,
                 color="#e41a1c")

    plt.subplot(412)

    plt.plot(third_rate_delay_values,
             tcp_gp_avg_third_rate,
             linestyle=':',
             marker='v',
             markersize=4,
             color='#377eb8',
             label="TCP")
    plt.plot(third_rate_delay_values,
             tls_gp_avg_third_rate,
             linestyle='-.',
             marker='^',
             markersize=4,
             color='#4daf4a',
             label="TCP/TLS")
    plt.plot(third_rate_delay_values,
             quic_gp_avg_third_rate,
             linestyle=shared.linestyles['densely dashdotted'],
             marker='s',
             markersize=4,
             color='#ff7f00',
             label="QUIC")

    plt.ylabel('Goodput/rate [%]')
    plt.xlabel('delay [ms]', labelpad=0)
    plt.xticks(first_rate_delay_values)
    plt.yticks(yticks_list)
    plt.legend()
    plt.grid(color='darkgray', linestyle=':')
    plt.title('Rate: {} KBit/s'.format(gp_avg["tcp-throughput"][0][2]))

    ax = plt.gca()
    ax.set_facecolor('white')
    plt.setp(ax.spines.values(), color='black')

    legend = plt.legend(loc="best", bbox_to_anchor=(0.58, 0.7))
    legend_frame = legend.get_frame()
    legend_frame.set_facecolor('white')

    plt.arrow(250.0,
              0.6,
              0.0,
              0.05,
              fc="#e41a1c",
              ec="#e41a1c",
              head_width=3,
              head_length=0.1,
              label="NB-IoT 1")
    plt.annotate('NB-IoT \n(600 UEs, Suburban)',
                 xy=(250.0, 0.35),
                 ha='center',
                 fontsize=10,
                 color="#e41a1c")

    plt.arrow(50.0,
              0.6,
              0.0,
              0.05,
              fc="#e41a1c",
              ec="#e41a1c",
              head_width=3,
              head_length=0.1,
              label="NB-IoT 1")
    plt.annotate('NB-IoT \n(200 UEs, Urban)',
                 xy=(55.0, 0.35),
                 ha='center',
                 fontsize=10,
                 color="#e41a1c")

    plt.arrow(10.0,
              0.8,
              0.0,
              0.05,
              fc="#e41a1c",
              ec="#e41a1c",
              head_width=3,
              head_length=0.1,
              label="NB-IoT 1")
    plt.annotate('LTE-M \n(200 UEs, Urban)',
                 xy=(10.0, 0.5),
                 ha='center',
                 fontsize=10,
                 color="#e41a1c")

    plt.subplot(413)

    plt.plot(second_rate_delay_values,
             tcp_gp_avg_second_rate,
             linestyle=':',
             marker='v',
             markersize=4,
             color='#377eb8',
             label="TCP")
    plt.plot(second_rate_delay_values,
             tls_gp_avg_second_rate,
             linestyle='-.',
             marker='^',
             markersize=4,
             color='#4daf4a',
             label="TCP/TLS")
    plt.plot(second_rate_delay_values,
             quic_gp_avg_second_rate,
             linestyle=shared.linestyles['densely dashdotted'],
             marker='s',
             markersize=4,
             color='#ff7f00',
             label="QUIC")

    plt.ylabel('Goodput/rate [%]')
    plt.xlabel('delay [ms]', labelpad=0)
    plt.xticks(first_rate_delay_values)
    plt.yticks(yticks_list)
    plt.legend()
    plt.grid(color='darkgray', linestyle=':')
    plt.title('Rate: {} KBit/s'.format(gp_avg["tcp-throughput"][0][1]))

    ax = plt.gca()
    ax.set_facecolor('white')
    plt.setp(ax.spines.values(), color='black')

    legend = plt.legend(loc="best", bbox_to_anchor=(0.58, 0.7))
    legend_frame = legend.get_frame()
    legend_frame.set_facecolor('white')

    plt.arrow(250.0,
              0.3,
              0.0,
              0.05,
              fc="#e41a1c",
              ec="#e41a1c",
              head_width=3,
              head_length=0.1,
              label="NB-IoT 1")
    plt.annotate('NB-IoT \n(600 UEs, Suburban)',
                 xy=(250.0, 0.1),
                 ha='center',
                 fontsize=10,
                 color="#e41a1c")

    plt.arrow(50.0,
              0.6,
              0.0,
              0.05,
              fc="#e41a1c",
              ec="#e41a1c",
              head_width=3,
              head_length=0.1,
              label="NB-IoT 1")
    plt.annotate('NB-IoT \n(200 UEs, Urban)',
                 xy=(55.0, 0.35),
                 ha='center',
                 fontsize=10,
                 color="#e41a1c")

    plt.arrow(10.0,
              0.8,
              0.0,
              0.05,
              fc="#e41a1c",
              ec="#e41a1c",
              head_width=3,
              head_length=0.1,
              label="NB-IoT 1")
    plt.annotate('LTE-M \n(200 UEs, Urban)',
                 xy=(10.0, 0.5),
                 ha='center',
                 fontsize=10,
                 color="#e41a1c")

    plt.subplot(414)

    plt.plot(first_rate_delay_values,
             tcp_gp_avg_first_rate,
             linestyle=':',
             marker='v',
             markersize=4,
             color='#377eb8',
             label="TCP")
    plt.plot(first_rate_delay_values,
             tls_gp_avg_first_rate,
             linestyle='-.',
             marker='^',
             markersize=4,
             color='#4daf4a',
             label="TCP/TLS")
    plt.plot(first_rate_delay_values,
             quic_gp_avg_first_rate,
             linestyle=shared.linestyles['densely dashdotted'],
             marker='s',
             markersize=4,
             color='#ff7f00',
             label="QUIC")

    plt.ylabel('Goodput/rate [%]')
    plt.xlabel('delay [ms]', labelpad=0)
    plt.xticks(first_rate_delay_values)
    plt.yticks(yticks_list)
    plt.legend()
    plt.grid(color='darkgray', linestyle=':')
    plt.title('Rate: {} KBit/s'.format(gp_avg["tcp-throughput"][0][0]))

    ax = plt.gca()
    ax.set_facecolor('white')
    plt.setp(ax.spines.values(), color='black')

    legend = plt.legend(loc="best", bbox_to_anchor=(0.58, 0.7))
    legend_frame = legend.get_frame()
    legend_frame.set_facecolor('white')

    plt.arrow(250.0,
              0.6,
              0.0,
              0.05,
              fc="#e41a1c",
              ec="#e41a1c",
              head_width=3,
              head_length=0.1,
              label="NB-IoT 1")
    plt.annotate('NB-IoT \n(600 UEs, Suburban)',
                 xy=(250.0, 0.35),
                 ha='center',
                 fontsize=10,
                 color="#e41a1c")

    plt.arrow(50.0,
              0.5,
              0.0,
              0.05,
              fc="#e41a1c",
              ec="#e41a1c",
              head_width=3,
              head_length=0.1,
              label="NB-IoT 1")
    plt.annotate('NB-IoT \n(200 UEs, Urban)',
                 xy=(55.0, 0.25),
                 ha='center',
                 fontsize=10,
                 color="#e41a1c")

    plt.arrow(10.0,
              0.6,
              0.0,
              0.05,
              fc="#e41a1c",
              ec="#e41a1c",
              head_width=3,
              head_length=0.1,
              label="NB-IoT 1")
    plt.annotate('LTE-M \n(200 UEs, Urban)',
                 xy=(10.0, 0.4),
                 ha='center',
                 fontsize=10,
                 color="#e41a1c")

    plt.subplots_adjust(hspace=0.5)

    result_file = shared.prepare_result(os.path.basename(__file__)[:-3])
    # fig.suptitle("Measurement campaign: Delay analysis \n {}".format(r'(Rate steps = 4, Delay steps = 6,  Iterations = 4, $t_{deadline} = 60s$)'), fontsize=14)
    #fig.suptitle("Impact of Delay: Microscopic analysis\n")
    fig.savefig(result_file, bbox_inches='tight')
def plot_data(gp_avg):

    print("processing data: ", gp_avg)

    quic500 = []
    tcp500 = []
    tls500 = []

    quic250 = []
    tcp250 = []
    tls250 = []

    quic50 = []
    tcp50 = []
    tls50 = []

    quic5 = []
    tcp5 = []
    tls5 = []

    analyzing_mean_good_bursts = [100, 50, 25]
    analyzing_mean_bad_bursts_inverted = [16, 8, 4, 2]

    # analyze good_bursts step by step
    for good_burst in analyzing_mean_good_bursts:

        for gb, proto_dict in gp_avg.items():

            # select a good_burst
            if gb == str(good_burst):

                # select śtep by step a protocol and process
                for proto, msmt_data in proto_dict.items():
                    print("\nanalyzing proto: ", proto)

                    # select a rate out of the rate list
                    for rate in msmt_data[0]:
                        print("\nanalyzing rate: ", rate)

                        # get index to get further data
                        index = msmt_data[0].index(rate)

                        # select corresponding bad bursts
                        bad_bursts = msmt_data[1][index]

                        # select result for good_burst, bad_bursts and rate
                        results = msmt_data[2][index]

                        # create tuples
                        for bad_burst in bad_bursts:
                            print("creating tuple for bad_burst: ", bad_burst)
                            index = bad_bursts.index(bad_burst)
                            result = results[index]

                            surface_tuple = (good_burst, bad_burst, result)
                            print("msmt_pt is: ", surface_tuple)

                            if rate == 500:
                                if proto == "tcp-throughput":
                                    tcp500.append(surface_tuple)
                                elif proto == "tcp-tls-throughput":
                                    tls500.append(surface_tuple)
                                elif proto == "quic-throughput":
                                    quic500.append(surface_tuple)
                                else:
                                    raise Exception('\nproto not supported!')

                            elif rate == 250:
                                if proto == "tcp-throughput":
                                    tcp250.append(surface_tuple)
                                elif proto == "tcp-tls-throughput":
                                    tls250.append(surface_tuple)
                                elif proto == "quic-throughput":
                                    quic250.append(surface_tuple)
                                else:
                                    raise Exception('\nproto not supported!')

                            elif rate == 50:
                                if proto == "tcp-throughput":
                                    tcp50.append(surface_tuple)
                                elif proto == "tcp-tls-throughput":
                                    tls50.append(surface_tuple)
                                elif proto == "quic-throughput":
                                    quic50.append(surface_tuple)
                                else:
                                    raise Exception('\nproto not supported!')

                            elif rate == 5:
                                if proto == "tcp-throughput":
                                    tcp5.append(surface_tuple)
                                elif proto == "tcp-tls-throughput":
                                    tls5.append(surface_tuple)
                                elif proto == "quic-throughput":
                                    quic5.append(surface_tuple)
                                else:
                                    raise Exception('\nproto not supported!')
                            else:
                                raise Exception('\nrate not supported!')

    print("\n\ntcp 500: ", tcp500)
    print("\n\nquic 500: ", quic500)
    print("\n\ntls 500: ", tls500)

    ### 500 kbits heatmaps ###

    quic500_values = []
    tcp500_values = []
    tls500_values = []

    # get quic values
    for tup in quic500:
        quic500_values.append(tup[2])

    # get tcp values
    for tup in tcp500:
        tcp500_values.append(tup[2])

    # get tcp values
    for tup in tls500:
        tls500_values.append(tup[2])

    # first plot
    fig = plt.figure(figsize=(35, 10))
    sns.set(font_scale=2.6)
    plt.subplot(131)

    np_array = np.array(quic500_values).reshape(3,
                                                4).swapaxes(-2,
                                                            -1)[..., ::-1, :]
    #print("\n\n numpy quic values are: ", np_array)

    # alternative: viridis
    ax = sns.heatmap(np_array,
                     xticklabels=analyzing_mean_good_bursts,
                     yticklabels=analyzing_mean_bad_bursts_inverted,
                     vmin=0.0,
                     vmax=1.0,
                     cmap="Blues",
                     cbar=False)

    ax.set_xlabel('mean good bursts [# packets]', fontsize=35)
    ax.set_ylabel('mean loss bursts [# packets]', fontsize=35)
    ax.set_title("QUIC", fontsize=35)

    plt.subplot(132)

    np_array = np.array(tls500_values).reshape(3, 4).swapaxes(-2,
                                                              -1)[..., ::-1, :]
    #print("\n\n numpy quic values are: ", np_array)

    # alternative: viridis
    ax = sns.heatmap(np_array,
                     xticklabels=analyzing_mean_good_bursts,
                     yticklabels=analyzing_mean_bad_bursts_inverted,
                     vmin=0.0,
                     vmax=1.0,
                     cmap="Blues",
                     cbar=False)

    ax.set_xlabel('mean good bursts [# packets]', fontsize=35)
    ax.set_ylabel('mean loss bursts [# packets]', fontsize=35)
    ax.set_title("TCP/TLS", fontsize=35)

    plt.subplot(133)

    np_array = np.array(tcp500_values).reshape(3, 4).swapaxes(-2,
                                                              -1)[..., ::-1, :]
    #print("\n\n numpy quic values are: ", np_array)

    # alternative: viridis
    ax = sns.heatmap(np_array,
                     xticklabels=analyzing_mean_good_bursts,
                     yticklabels=analyzing_mean_bad_bursts_inverted,
                     vmin=0.0,
                     vmax=1.0,
                     cmap="Blues")

    ax.set_xlabel('mean good bursts [# packets]', fontsize=35)
    ax.set_ylabel('mean loss bursts [# packets]', fontsize=35)
    ax.set_title("TCP", fontsize=35)

    plt.subplots_adjust(wspace=0.5)
    msmt_name = os.path.basename(__file__)[:-3] + "HeatRate{}".format(500)
    result_file = shared.prepare_result(msmt_name)

    #fig.suptitle("Impact of varying the good burst / bad burst ratio for rate = {} KBit/s\n".format(500), fontsize=35)
    fig.savefig(result_file, bbox_inches='tight')

    ### 250 kbits heatmaps ###

    quic250_values = []
    tcp250_values = []
    tls250_values = []

    # get quic values
    for tup in quic250:
        quic250_values.append(tup[2])

    # get tcp values
    for tup in tcp250:
        tcp250_values.append(tup[2])

    # get tcp values
    for tup in tls250:
        tls250_values.append(tup[2])

    # first plot
    fig = plt.figure(figsize=(35, 10))
    plt.subplot(131)

    np_array = np.array(quic250_values).reshape(3,
                                                4).swapaxes(-2,
                                                            -1)[..., ::-1, :]
    #print("\n\n numpy quic values are: ", np_array)

    # alternative: viridis
    ax = sns.heatmap(np_array,
                     xticklabels=analyzing_mean_good_bursts,
                     yticklabels=analyzing_mean_bad_bursts_inverted,
                     vmin=0.0,
                     vmax=1.0,
                     cmap="Blues",
                     cbar=False)

    ax.set_xlabel('mean good bursts [# packets]', fontsize=35)
    ax.set_ylabel('mean loss bursts [# packets]', fontsize=35)
    ax.set_title("QUIC", fontsize=35)

    plt.subplot(132)

    np_array = np.array(tls250_values).reshape(3, 4).swapaxes(-2,
                                                              -1)[..., ::-1, :]
    #print("\n\n numpy quic values are: ", np_array)

    # alternative: viridis
    ax = sns.heatmap(np_array,
                     xticklabels=analyzing_mean_good_bursts,
                     yticklabels=analyzing_mean_bad_bursts_inverted,
                     vmin=0.0,
                     vmax=1.0,
                     cmap="Blues",
                     cbar=False)

    ax.set_xlabel('mean good bursts [# packets]', fontsize=35)
    ax.set_ylabel('mean loss bursts [# packets]', fontsize=35)
    ax.set_title("TCP/TLS", fontsize=35)

    plt.subplot(133)

    np_array = np.array(tcp250_values).reshape(3, 4).swapaxes(-2,
                                                              -1)[..., ::-1, :]
    #print("\n\n numpy quic values are: ", np_array)

    # alternative: viridis
    ax = sns.heatmap(np_array,
                     xticklabels=analyzing_mean_good_bursts,
                     yticklabels=analyzing_mean_bad_bursts_inverted,
                     vmin=0.0,
                     vmax=1.0,
                     cmap="Blues")

    ax.set_xlabel('mean good bursts [# packets]', fontsize=35)
    ax.set_ylabel('mean loss bursts [# packets]', fontsize=35)
    ax.set_title("TCP", fontsize=35)

    plt.subplots_adjust(wspace=0.5)
    msmt_name = os.path.basename(__file__)[:-3] + "HeatRate{}".format(250)
    result_file = shared.prepare_result(msmt_name)

    #fig.suptitle("Impact of varying the good burst / bad burst ratio for rate = {} KBit/s\n".format(250), fontsize=35)
    fig.savefig(result_file, bbox_inches='tight')

    ### 50 kbits heatmaps ###

    quic50_values = []
    tcp50_values = []
    tls50_values = []

    # get quic values
    for tup in quic50:
        quic50_values.append(tup[2])

    # get tcp values
    for tup in tcp50:
        tcp50_values.append(tup[2])

    # get tcp values
    for tup in tls50:
        tls50_values.append(tup[2])

    # first plot
    fig = plt.figure(figsize=(35, 10))
    plt.subplot(131)

    np_array = np.array(quic50_values).reshape(3, 4).swapaxes(-2,
                                                              -1)[..., ::-1, :]
    #print("\n\n numpy quic values are: ", np_array)

    # alternative: viridis
    ax = sns.heatmap(np_array,
                     xticklabels=analyzing_mean_good_bursts,
                     yticklabels=analyzing_mean_bad_bursts_inverted,
                     vmin=0.0,
                     vmax=1.0,
                     cmap="Blues",
                     cbar=False)

    ax.set_xlabel('mean good bursts [# packets]', fontsize=35)
    ax.set_ylabel('mean loss bursts [# packets]', fontsize=35)
    ax.set_title("QUIC", fontsize=35)

    plt.subplot(132)

    np_array = np.array(tls50_values).reshape(3, 4).swapaxes(-2,
                                                             -1)[..., ::-1, :]
    #print("\n\n numpy quic values are: ", np_array)

    # alternative: viridis
    ax = sns.heatmap(np_array,
                     xticklabels=analyzing_mean_good_bursts,
                     yticklabels=analyzing_mean_bad_bursts_inverted,
                     vmin=0.0,
                     vmax=1.0,
                     cmap="Blues",
                     cbar=False)

    ax.set_xlabel('mean good bursts [# packets]', fontsize=35)
    ax.set_ylabel('mean loss bursts [# packets]', fontsize=35)
    ax.set_title("TCP/TLS", fontsize=35)

    plt.subplot(133)

    np_array = np.array(tcp50_values).reshape(3, 4).swapaxes(-2,
                                                             -1)[..., ::-1, :]
    #print("\n\n numpy quic values are: ", np_array)

    # alternative: viridis
    ax = sns.heatmap(np_array,
                     xticklabels=analyzing_mean_good_bursts,
                     yticklabels=analyzing_mean_bad_bursts_inverted,
                     vmin=0.0,
                     vmax=1.0,
                     cmap="Blues")

    ax.set_xlabel('mean good bursts [# packets]', fontsize=35)
    ax.set_ylabel('mean loss bursts [# packets]', fontsize=35)
    ax.set_title("TCP", fontsize=35)

    plt.subplots_adjust(wspace=0.5)
    msmt_name = os.path.basename(__file__)[:-3] + "HeatRate{}".format(50)
    result_file = shared.prepare_result(msmt_name)

    #fig.suptitle("Impact of varying the good burst / bad burst ratio for rate = {} KBit/s\n".format(50), fontsize=35)
    fig.savefig(result_file, bbox_inches='tight')

    ### 5 kbits heatmaps ###

    quic5_values = []
    tcp5_values = []
    tls5_values = []

    # get quic values
    for tup in quic5:
        quic5_values.append(tup[2])

    # get tcp values
    for tup in tcp5:
        tcp5_values.append(tup[2])

    # get tcp values
    for tup in tls5:
        tls5_values.append(tup[2])

    # first plot
    fig = plt.figure(figsize=(35, 10))
    plt.subplot(131)

    np_array = np.array(quic5_values).reshape(3, 4).swapaxes(-2,
                                                             -1)[..., ::-1, :]
    #print("\n\n numpy quic values are: ", np_array)

    # alternative: viridis
    ax = sns.heatmap(np_array,
                     xticklabels=analyzing_mean_good_bursts,
                     yticklabels=analyzing_mean_bad_bursts_inverted,
                     vmin=0.0,
                     vmax=1.0,
                     cmap="Blues",
                     cbar=False)

    ax.set_xlabel('mean good bursts [# packets]', fontsize=35)
    ax.set_ylabel('mean loss bursts [# packets]', fontsize=35)
    ax.set_title("QUIC", fontsize=35)

    plt.subplot(132)

    np_array = np.array(tls5_values).reshape(3, 4).swapaxes(-2,
                                                            -1)[..., ::-1, :]
    #print("\n\n numpy quic values are: ", np_array)

    # alternative: viridis
    ax = sns.heatmap(np_array,
                     xticklabels=analyzing_mean_good_bursts,
                     yticklabels=analyzing_mean_bad_bursts_inverted,
                     vmin=0.0,
                     vmax=1.0,
                     cmap="Blues",
                     cbar=False)

    ax.set_xlabel('mean good bursts [# packets]', fontsize=35)
    ax.set_ylabel('mean loss bursts [# packets]', fontsize=35)
    ax.set_title("TCP/TLS", fontsize=35)

    plt.subplot(133)

    np_array = np.array(tcp5_values).reshape(3, 4).swapaxes(-2,
                                                            -1)[..., ::-1, :]
    #print("\n\n numpy quic values are: ", np_array)

    # alternative: viridis
    ax = sns.heatmap(np_array,
                     xticklabels=analyzing_mean_good_bursts,
                     yticklabels=analyzing_mean_bad_bursts_inverted,
                     vmin=0.0,
                     vmax=1.0,
                     cmap="Blues")

    ax.set_xlabel('mean good bursts [# packets]', fontsize=35)
    ax.set_ylabel('mean loss bursts [# packets]', fontsize=35)
    ax.set_title("TCP", fontsize=35)

    plt.subplots_adjust(wspace=0.5)
    msmt_name = os.path.basename(__file__)[:-3] + "HeatRate{}".format(5)
    result_file = shared.prepare_result(msmt_name)

    #fig.suptitle("Impact of varying the good burst / bad burst ratio for rate = {} KBit/s\n".format(5), fontsize=35)
    fig.savefig(result_file, bbox_inches='tight')
Beispiel #9
0
def plot_data(gp_avg, gp_max, gp_min):
    tcp_rate = gp_avg["tcp-throughput"][0]
    tcp_avg = gp_avg["tcp-throughput"][1]
    tcp_max = gp_max["tcp-throughput"][1]
    tcp_min = gp_min["tcp-throughput"][1]

    tls_rate = gp_avg["tcp-tls-throughput"][0]
    tls_avg = gp_avg["tcp-tls-throughput"][1]
    tls_max = gp_max["tcp-tls-throughput"][1]
    tls_min = gp_min["tcp-tls-throughput"][1]

    quic_rate = gp_avg["quic-throughput"][0]
    quic_avg = gp_avg["quic-throughput"][1]
    quic_max = gp_max["quic-throughput"][1]
    quic_min = gp_min["quic-throughput"][1]

    fig = plt.figure(figsize=(11, 9))
    # fig = plt.figure(figsize=(13, 11))

    ay1 = plt.subplot(311)

    plt.plot(tcp_rate,
             tcp_avg,
             linestyle='-',
             marker='v',
             color='#377eb8',
             label="Average")
    plt.fill_between(tcp_rate,
                     tcp_min,
                     tcp_max,
                     facecolor='#377eb8',
                     alpha=0.25,
                     label='Range')

    plt.ylabel('Goodput/rate [%]')
    plt.xlabel('rate [KBit/s]', labelpad=0)
    plt.xticks(analyzing_rates)
    plt.yticks(yticks_list)
    plt.legend()
    plt.gca().invert_xaxis()
    plt.grid(color='darkgray', linestyle=':')
    plt.title('TCP')

    ax = plt.gca()
    ax.set_facecolor('white')
    plt.setp(ax.spines.values(), color='black')

    plt.subplot(312, sharey=ay1)

    plt.plot(tls_rate,
             tls_avg,
             linestyle='-',
             marker='v',
             color='#377eb8',
             label="Average")
    plt.fill_between(tls_rate,
                     tls_min,
                     tls_max,
                     facecolor='#377eb8',
                     alpha=0.25,
                     label='Range')

    plt.ylabel('Goodput/rate [%]')
    plt.xlabel('rate [KBit/s]', labelpad=0)
    plt.xticks(analyzing_rates)
    plt.yticks(yticks_list)
    plt.legend()
    plt.gca().invert_xaxis()
    plt.grid(color='darkgray', linestyle=':')
    plt.title('TCP/TLS')

    ax = plt.gca()
    ax.set_facecolor('white')
    plt.setp(ax.spines.values(), color='black')

    plt.subplot(313, sharey=ay1)

    plt.plot(quic_rate,
             quic_avg,
             linestyle='-',
             marker='v',
             color='#377eb8',
             label="Average")
    plt.fill_between(quic_rate,
                     quic_min,
                     quic_max,
                     facecolor='#377eb8',
                     alpha=0.25,
                     label='Range')

    plt.ylabel('Goodput/rate [%]')
    plt.xlabel('rate [KBit/s]', labelpad=0)
    plt.xticks(analyzing_rates)
    plt.yticks(yticks_list)
    plt.legend()
    plt.gca().invert_xaxis()
    plt.grid(color='darkgray', linestyle=':')
    plt.title('QUIC')

    ax = plt.gca()
    ax.set_facecolor('white')
    plt.setp(ax.spines.values(), color='black')

    plt.subplots_adjust(hspace=0.5)
    result_file = shared.prepare_result(os.path.basename(__file__)[:-3])
    #fig.suptitle("Measurement campaign: Rate limitation with critical threshold analysis\n {}".format(r'(Steps = 10, Iterations = 10, $t_{deadline} = 60s$)'), fontsize=14)
    fig.savefig(result_file, bbox_inches='tight')
def plot_data_smoothing_total(gp_avg, protocol):
    zero_x_axis_conn1 = []
    zero_x_axis_conn2 = []
    zero_y_axis_conn1 = []
    zero_y_axis_conn2 = []
    zero_xticks_list = []

    one_x_axis_conn1 = []
    one_x_axis_conn2 = []
    one_y_axis_conn1 = []
    one_y_axis_conn2 = []
    one_xticks_list = []


    two_x_axis_conn1 = []
    two_x_axis_conn2 = []
    two_y_axis_conn1 = []
    two_y_axis_conn2 = []
    two_xticks_list = []


    three_x_axis_conn1 = []
    three_x_axis_conn2 = []
    three_y_axis_conn1 = []
    three_y_axis_conn2 = []
    three_xticks_list = []

    rate = []
    for key, value in gp_avg.items():
        # key is now the specific rate
        # and value is the corresponding total_result

        if key == analyzing_rates[0]:
            print("plotting intra fairness for rate: ", key)
            zero_x_axis_conn1 = value[0][0]
            zero_x_axis_conn2 = value[0][1]

            zero_y_axis_conn1 = value[1][0]

            zero_y_axis_conn2 = value[1][1] 
            
            last_x_conn1 = zero_x_axis_conn1[-1]
            last_x_conn2 = zero_x_axis_conn2[-1]
            
            if last_x_conn1 >= last_x_conn2:
                last_x = last_x_conn1
            else:
                last_x = last_x_conn2

            current_x = 0
            zero_xticks_list.append(current_x)
            
            while current_x < last_x:
                current_x = current_x + 20
                zero_xticks_list.append(current_x)            


        elif key == analyzing_rates[1]:
            print("plotting intra fairness for rate: ", key)

            one_x_axis_conn1 = value[0][0]
            one_x_axis_conn2 = value[0][1]

            one_y_axis_conn1 = value[1][0]

            one_y_axis_conn2 = value[1][1] 

            
            last_x_conn1 = one_x_axis_conn1[-1]
            last_x_conn2 = one_x_axis_conn2[-1]
            
            if last_x_conn1 >= last_x_conn2:
                last_x = last_x_conn1
            else:
                last_x = last_x_conn2

            current_x = 0
            one_xticks_list.append(current_x)
            
            while current_x < last_x:
                current_x = current_x + 20
                one_xticks_list.append(current_x)    

        elif key == analyzing_rates[2]:
            print("plotting intra fairness for rate: ", key)

            two_x_axis_conn1 = value[0][0]
            two_x_axis_conn2 = value[0][1]

            two_y_axis_conn1 = value[1][0]

            two_y_axis_conn2 = value[1][1] 

            
            last_x_conn1 = two_x_axis_conn1[-1]
            last_x_conn2 = two_x_axis_conn2[-1]
            
            if last_x_conn1 >= last_x_conn2:
                last_x = last_x_conn1
            else:
                last_x = last_x_conn2

            current_x = 0
            two_xticks_list.append(current_x)
            
            while current_x < last_x:
                current_x = current_x + 20
                two_xticks_list.append(current_x)    

    # first plot
    fig = plt.figure(figsize=(11, 9))
    ay1 = plt.subplot(411) 

    plt.plot(zero_x_axis_conn1, zero_y_axis_conn1, marker='v', markersize=4, color='#377eb8', label="QUIC1")
    plt.plot(zero_x_axis_conn2, zero_y_axis_conn2, marker='v', markersize=4, color='#4daf4a', label="QUIC2")

    plt.ylabel('Goodput/rate [%]')
    plt.xlabel('time [s]', labelpad=0)
    plt.xticks(zero_xticks_list)
    plt.yticks(yticks_list)
    
    
    plt.legend()

    
    # we dont need that plt.gca().invert_xaxis()
    plt.grid(color='darkgray', linestyle=':')
    plt.title('Rate: {} KBit/s'.format(500))

    ax = plt.gca()
    ax.set_facecolor('white')
    plt.setp(ax.spines.values(), color='black')
    legend = plt.legend()
    legend_frame = legend.get_frame()
    legend_frame.set_facecolor('white')



    plt.subplot(412) 

    plt.plot(one_x_axis_conn1, one_y_axis_conn1, marker='v', markersize=4, color='#377eb8', label="QUIC1")
    plt.plot(one_x_axis_conn2, one_y_axis_conn2, marker='v', markersize=4, color='#4daf4a', label="QUIC2")

    plt.ylabel('Goodput/rate [%]')
    plt.xlabel('time [s]', labelpad=0)
    plt.xticks(one_xticks_list)
    plt.yticks(yticks_list)
    
    plt.legend()
    # we dont need that plt.gca().invert_xaxis()
    plt.grid(color='darkgray', linestyle=':')
    plt.title('Rate: {} KBit/s'.format(250))

    ax = plt.gca()
    ax.set_facecolor('white')
    plt.setp(ax.spines.values(), color='black')
    legend = plt.legend()
    legend_frame = legend.get_frame()
    legend_frame.set_facecolor('white')



    plt.subplot(413) 



    plt.plot(two_x_axis_conn1, two_y_axis_conn1, marker='v', markersize=4, color='#377eb8', label="QUIC1")
    plt.plot(two_x_axis_conn2, two_y_axis_conn2, marker='v', markersize=4, color='#4daf4a', label="QUIC2")

    plt.ylabel('Goodput/rate [%]')
    plt.xlabel('time [s]', labelpad=0)
    plt.xticks(two_xticks_list)
    plt.yticks(yticks_list)
    

    plt.legend()
    # we dont need that plt.gca().invert_xaxis()
    plt.grid(color='darkgray', linestyle=':')
    plt.title('Rate: {} KBit/s'.format(50))

    ax = plt.gca()
    ax.set_facecolor('white')
    plt.setp(ax.spines.values(), color='black')
    legend = plt.legend()
    legend_frame = legend.get_frame()
    legend_frame.set_facecolor('white')


    ''' wont work atm
    plt.subplot(414) 


    plt.plot(3_x_axis_conn1, 3_y_axis_conn1, marker='v', markersize=4, color='#377eb8', label="QUIC1")
    plt.plot(3_x_axis_conn2, 3_y_axis_conn2, marker='v', markersize=4, color='#4daf4a', label="QUIC2")

    plt.ylabel('Goodput/rate [%]')
    plt.xlabel('time [s]', labelpad=0)
    plt.xticks(3_xticks_list)
    plt.yticks(yticks_list)
    
    plt.legend()
    # we dont need that plt.gca().invert_xaxis()
    plt.grid(color='darkgray', linestyle=':')
    plt.title('Rate: {} KBit/s'.format(5))

    '''





    plt.subplots_adjust(hspace = 0.5)
    msmt_name = os.path.basename(__file__)[:-3] + "{}".format(protocol)
    result_file = shared.prepare_result(msmt_name)
    # fig.suptitle(r'Rate limitation: Critical threshold analysis \n (Steps = 4, Iterations = 4, $\alpha_i > \beta_i$)', fontsize=14)
    # fig.suptitle("Measurement module: Loss analysis\n {}".format(r'(Rate steps = 4, Loss steps = 4,  Iterations = 4, $t_{deadline} = 60s$)'), fontsize=14)
    fig.suptitle("Summary: Impact of Jitter for 500 KBit/s\n")
    
    fig.savefig(result_file, bbox_inches='tight')
def plot_data_bar_plot(quic_result, tls_result, tcp_result):
    print("\n\nquic res: ", quic_result)
    print("\n\ntls res: ", tls_result)
    print("\n\ntls res: ", tls_result)


    ind = np.arange(0, len(quic_result) * 0.25, 0.25)  # the x locations for the groups
    # width = 0.35  # the width of the bars
    width = 0.05  # the width of the bars

    fig = plt.figure(figsize=(15, 10))
    ay1 = plt.subplot(211) 

    print("\nquic result", quic_result)
    print("\ntcp result", tls_result)

    rects1 = plt.bar(ind - 3.5 * width/3, quic_result, width, color='#ff7f00', label="QUIC")
    rects2 = plt.bar(ind, tls_result, width, color='#4daf4a', label="TCP/TLS")
    rects3 = plt.bar(ind + 3.5 * width/3, tcp_result, width, color='#377eb8', label="TCP")



    plt.ylabel('Goodput/rate [%]', fontsize=15)
    plt.xticks(ind)

    ay1.set_xticklabels(('10 ms', '50 ms', '250 ms', '1000 ms'), fontsize=15)
    
    plt.yticks(yticks_list)
    # plt.xlabel(('500', '250', '50'), fontsize=15)
    # plt.legend()
    legend = plt.legend()
    
    # we dont need that plt.gca().invert_xaxis()
    plt.grid(color='darkgray', linestyle=':')
    autolabel(ay1, rects1, "left")
    autolabel(ay1, rects2, "center")
    autolabel(ay1, rects3, "right")

    # second plot

    '''
    ay2 = plt.subplot(212) 

    rects3 = plt.bar(ind - width/2, tcp_result[0], width, color='#377eb8', label='TCP/TLS1')
    rects4 = plt.bar(ind + width/2, tcp_result[1], width, color='#4daf4a', label='TCP/TLS2')


    plt.ylabel('Goodput/rate [%]', fontsize=15)
    plt.title('TCP + TLS', fontsize=15)
    plt.xticks(ind)
    ay2.set_xticklabels(('500', '250 KBit/s', '50 KBit/s'), fontsize=15)
    plt.yticks(yticks_list)
    # plt.xlabel(('500', '250', '50'), fontsize=15)
    plt.legend()
    # we dont need that plt.gca().invert_xaxis()
    plt.grid(color='darkgray', linestyle=':')
    autolabel(ay2, rects3, "left")
    autolabel(ay2, rects4, "right")
    '''
    ax = plt.gca()
    ax.set_facecolor('white')
    plt.setp(ax.spines.values(), color='black')
    legend = plt.legend(loc="best", bbox_to_anchor=(0.15,0.7))
    legend_frame = legend.get_frame()
    legend_frame.set_facecolor('white')

    plt.subplots_adjust(hspace = 0.5)
    msmt_name = os.path.basename(__file__)[:-3]
    result_file = shared.prepare_result(msmt_name)
    # fig.suptitle(r'Rate limitation: Critical threshold analysis \n (Steps = 4, Iterations = 4, $\alpha_i > \beta_i$)', fontsize=14)
    # fig.suptitle("Measurement module: Loss analysis\n {}".format(r'(Rate steps = 4, Loss steps = 4,  Iterations = 4, $t_{deadline} = 60s$)'), fontsize=14)
    # iot fig.suptitle("Summary: Impact of Delay on NB-IoT (32.4 KBit/s)\n")
    # fig.suptitle("Summary: Impact of Delay for 500 KBit/s\n")
    

    fig.savefig(result_file, bbox_inches='tight')
def plot_data(gp_avg):

    for key, value in gp_avg.items():
        print("\n\ncurrent key: {}".format(key))
        print("current value: {}".format(value))

        tcp_gp_avg_first_rate = value["tcp-throughput"][2][0]
        tcp_gp_avg_second_rate = value["tcp-throughput"][2][1]
        tcp_gp_avg_third_rate = value["tcp-throughput"][2][2]
        tcp_gp_avg_fourth_rate = value["tcp-throughput"][2][3]

        tls_gp_avg_first_rate = value["tcp-tls-throughput"][2][0]
        tls_gp_avg_second_rate = value["tcp-tls-throughput"][2][1]
        tls_gp_avg_third_rate = value["tcp-tls-throughput"][2][2]
        tls_gp_avg_fourth_rate = value["tcp-tls-throughput"][2][3]

        quic_gp_avg_first_rate = value["quic-throughput"][2][0]
        quic_gp_avg_second_rate = value["quic-throughput"][2][1]
        quic_gp_avg_third_rate = value["quic-throughput"][2][2]
        quic_gp_avg_fourth_rate = value["quic-throughput"][2][3]

        # one can also use the other protocols loss values.
        # also ensures different loss values => add ons for future
        first_rate_loss_values = value["quic-throughput"][1][0]
        second_rate_loss_values = value["quic-throughput"][1][1]
        third_rate_loss_values = value["quic-throughput"][1][2]
        fourth_rate_loss_values = value["quic-throughput"][1][3]

        # first plot
        fig = plt.figure(figsize=(11, 9))
        ay1 = plt.subplot(411)
        plt.plot(first_rate_loss_values,
                 tcp_gp_avg_first_rate,
                 linestyle=':',
                 marker='v',
                 markersize=4,
                 color='#377eb8',
                 label="TCP")
        plt.plot(first_rate_loss_values,
                 tls_gp_avg_first_rate,
                 linestyle='-.',
                 marker='^',
                 markersize=4,
                 color='#4daf4a',
                 label="TCP/TLS")
        # plt.plot(first_rate_loss_values, udp_gp_avg_first_rate, linestyle='--', marker='o', markersize=4, color='#984ea3', label="UDP")
        plt.plot(first_rate_loss_values,
                 quic_gp_avg_first_rate,
                 linestyle=shared.linestyles['densely dashdotted'],
                 marker='s',
                 markersize=4,
                 color='#ff7f00',
                 label="QUIC")

        plt.ylabel('Goodput/rate [%]')
        plt.xlabel('mean loss bursts [# packets]', labelpad=0)
        plt.xticks(first_rate_loss_values)
        plt.yticks(yticks_list)

        plt.legend()
        # we dont need that plt.gca().invert_xaxis()
        plt.grid(color='darkgray', linestyle=':')
        plt.title('Rate: {} KBit/s'.format(value["quic-throughput"][0][0]))

        ax = plt.gca()
        ax.set_facecolor('white')
        plt.setp(ax.spines.values(), color='black')
        legend = plt.legend()
        legend_frame = legend.get_frame()
        legend_frame.set_facecolor('white')

        plt.subplot(412)
        plt.plot(second_rate_loss_values,
                 tcp_gp_avg_second_rate,
                 linestyle=':',
                 marker='v',
                 markersize=4,
                 color='#377eb8',
                 label="TCP")
        plt.plot(second_rate_loss_values,
                 tls_gp_avg_second_rate,
                 linestyle='-.',
                 marker='^',
                 markersize=4,
                 color='#4daf4a',
                 label="TCP/TLS")
        # plt.plot(second_rate_loss_values, udp_gp_avg_second_rate, linestyle='--', marker='o', markersize=4, color='#984ea3', label="UDP")
        plt.plot(second_rate_loss_values,
                 quic_gp_avg_second_rate,
                 linestyle=shared.linestyles['densely dashdotted'],
                 marker='s',
                 markersize=4,
                 color='#ff7f00',
                 label="QUIC")

        plt.ylabel('Goodput/rate [%]')
        plt.xlabel('mean loss bursts [# packets]', labelpad=0)
        plt.xticks(second_rate_loss_values)
        plt.yticks(yticks_list)

        plt.legend()
        # we dont need that plt.gca().invert_xaxis()
        plt.grid(color='darkgray', linestyle=':')
        plt.title('Rate: {} KBit/s'.format(value["quic-throughput"][0][1]))

        ax = plt.gca()
        ax.set_facecolor('white')
        plt.setp(ax.spines.values(), color='black')
        legend = plt.legend()
        legend_frame = legend.get_frame()
        legend_frame.set_facecolor('white')

        plt.subplot(413)
        plt.plot(third_rate_loss_values,
                 tcp_gp_avg_third_rate,
                 linestyle=':',
                 marker='v',
                 markersize=4,
                 color='#377eb8',
                 label="TCP")
        plt.plot(third_rate_loss_values,
                 tls_gp_avg_third_rate,
                 linestyle='-.',
                 marker='^',
                 markersize=4,
                 color='#4daf4a',
                 label="TCP/TLS")
        # plt.plot(third_rate_loss_values, udp_gp_avg_third_rate, linestyle='--', marker='o', markersize=4, color='#984ea3', label="UDP")
        plt.plot(third_rate_loss_values,
                 quic_gp_avg_third_rate,
                 linestyle=shared.linestyles['densely dashdotted'],
                 marker='s',
                 markersize=4,
                 color='#ff7f00',
                 label="QUIC")

        plt.ylabel('Goodput/rate [%]')
        plt.xlabel('mean loss bursts [# packets]', labelpad=0)
        plt.xticks(third_rate_loss_values)
        plt.yticks(yticks_list)

        plt.legend()
        # we dont need that plt.gca().invert_xaxis()
        plt.grid(color='darkgray', linestyle=':')
        plt.title('Rate: {} KBit/s'.format(value["quic-throughput"][0][2]))

        ax = plt.gca()
        ax.set_facecolor('white')
        plt.setp(ax.spines.values(), color='black')
        legend = plt.legend()
        legend_frame = legend.get_frame()
        legend_frame.set_facecolor('white')

        plt.subplot(414)

        plt.plot(fourth_rate_loss_values,
                 tcp_gp_avg_fourth_rate,
                 linestyle=':',
                 marker='v',
                 markersize=4,
                 color='#377eb8',
                 label="TCP")
        plt.plot(fourth_rate_loss_values,
                 tls_gp_avg_fourth_rate,
                 linestyle='-.',
                 marker='^',
                 markersize=4,
                 color='#4daf4a',
                 label="TCP/TLS")
        # plt.plot(fourth_rate_loss_values, udp_gp_avg_fourth_rate, linestyle='--', marker='o', markersize=4, color='#984ea3', label="UDP")
        plt.plot(fourth_rate_loss_values,
                 quic_gp_avg_fourth_rate,
                 linestyle=shared.linestyles['densely dashdotted'],
                 marker='s',
                 markersize=4,
                 color='#ff7f00',
                 label="QUIC")

        plt.ylabel('Goodput/rate [%]')
        plt.xlabel('mean loss bursts [# packets]', labelpad=0)
        plt.xticks(fourth_rate_loss_values)
        plt.yticks(yticks_list)

        plt.legend()

        # we dont need that plt.gca().invert_xaxis()
        plt.grid(color='darkgray', linestyle=':')
        plt.title('Rate: {} KBit/s'.format(value["quic-throughput"][0][3]))

        ax = plt.gca()
        ax.set_facecolor('white')
        plt.setp(ax.spines.values(), color='black')
        legend = plt.legend()
        legend_frame = legend.get_frame()
        legend_frame.set_facecolor('white')

        plt.subplots_adjust(hspace=0.5)
        msmt_name = os.path.basename(__file__)[:-3] + "{}".format(key)
        result_file = shared.prepare_result(msmt_name)
        # fig.suptitle(r'Rate limitation: Critical threshold analysis \n (Steps = 4, Iterations = 4, $\alpha_i > \beta_i$)', fontsize=14)
        # fig.suptitle("Measurement module: Loss analysis\n {}".format(r'(Rate steps = 4, Loss steps = 4,  Iterations = 4, $t_{deadline} = 60s$)'), fontsize=14)
        #fig.suptitle("Impact of burst errors with mean-PER of 20 %\n".format(key))

        fig.savefig(result_file, bbox_inches='tight')