| # Plot vertical lines | # Plot vertical lines | ||||
| first = True | first = True | ||||
| lte_handovers = transmission_df["Cell_ID"].dropna().diff() | lte_handovers = transmission_df["Cell_ID"].dropna().diff() | ||||
| lte_hanover_plot = None | |||||
| for index, value in lte_handovers.items(): | for index, value in lte_handovers.items(): | ||||
| if value > 0: | if value > 0: | ||||
| if first: | if first: | ||||
| ax00.axvline( | |||||
| lte_hanover_plot = ax00.axvline( | |||||
| index, ymin=0, ymax=1, color="skyblue", label="4G Handover" | index, ymin=0, ymax=1, color="skyblue", label="4G Handover" | ||||
| ) | ) | ||||
| first = False | first = False | ||||
| nr_handovers = ( | nr_handovers = ( | ||||
| transmission_df["NR5G_Cell_ID"].replace(0, np.NaN).dropna().diff() | transmission_df["NR5G_Cell_ID"].replace(0, np.NaN).dropna().diff() | ||||
| ) | ) | ||||
| nr_hanover_plot = None | |||||
| for index, value in nr_handovers.items(): | for index, value in nr_handovers.items(): | ||||
| if value > 0: | if value > 0: | ||||
| if first: | if first: | ||||
| ax00.axvline( | |||||
| nr_hanover_plot = ax00.axvline( | |||||
| index, ymin=0, ymax=1, color="greenyellow", label="5G Handover" | index, ymin=0, ymax=1, color="greenyellow", label="5G Handover" | ||||
| ) | ) | ||||
| first = False | first = False | ||||
| else: | else: | ||||
| ax00.axvline(index, ymin=0, ymax=1, color="greenyellow") | ax00.axvline(index, ymin=0, ymax=1, color="greenyellow") | ||||
| ax0.plot( | |||||
| snd_plot = ax0.plot( | |||||
| transmission_df["snd_cwnd"].dropna(), | transmission_df["snd_cwnd"].dropna(), | ||||
| color="lime", | color="lime", | ||||
| linestyle="dashed", | linestyle="dashed", | ||||
| label="cwnd", | label="cwnd", | ||||
| ) | ) | ||||
| ax1.plot( | |||||
| srtt_plot = ax1.plot( | |||||
| transmission_df["srtt"].dropna(), | transmission_df["srtt"].dropna(), | ||||
| color="red", | color="red", | ||||
| linestyle="dashdot", | linestyle="dashdot", | ||||
| label="sRTT", | label="sRTT", | ||||
| ) | ) | ||||
| ax2.plot( | |||||
| goodput_plot = ax2.plot( | |||||
| transmission_df["goodput_rolling"], | transmission_df["goodput_rolling"], | ||||
| color="blue", | color="blue", | ||||
| linestyle="solid", | linestyle="solid", | ||||
| ) | ) | ||||
| # ax2.plot(transmission_df["goodput"], color="blue", linestyle="solid", label="goodput") | # ax2.plot(transmission_df["goodput"], color="blue", linestyle="solid", label="goodput") | ||||
| ax01.plot( | |||||
| eff_bw_plot = ax01.plot( | |||||
| transmission_df["effective_bw_sum"].dropna(), | transmission_df["effective_bw_sum"].dropna(), | ||||
| color="peru", | color="peru", | ||||
| linestyle="solid", | linestyle="solid", | ||||
| label="bandwidth", | label="bandwidth", | ||||
| ) | ) | ||||
| ax01.plot( | |||||
| lte_eff_bw_plot = ax01.plot( | |||||
| transmission_df["lte_effective_bw_sum"].dropna(), | transmission_df["lte_effective_bw_sum"].dropna(), | ||||
| color="lightsteelblue", | color="lightsteelblue", | ||||
| linestyle="solid", | linestyle="solid", | ||||
| label="4G bandwidth", | label="4G bandwidth", | ||||
| alpha=0.5, | alpha=0.5, | ||||
| ) | ) | ||||
| ax01.plot( | |||||
| nr_eff_bw_plot = ax01.plot( | |||||
| transmission_df["nr_effective_bw_sum"].dropna(), | transmission_df["nr_effective_bw_sum"].dropna(), | ||||
| color="cornflowerblue", | color="cornflowerblue", | ||||
| linestyle="solid", | linestyle="solid", | ||||
| # labels=["4G bandwidth", "5G bandwidth"] | # labels=["4G bandwidth", "5G bandwidth"] | ||||
| # ) | # ) | ||||
| ax02.plot( | |||||
| lte_rsrq_plot = ax02.plot( | |||||
| transmission_df["RSRQ_(dB)"].dropna(), | transmission_df["RSRQ_(dB)"].dropna(), | ||||
| color="purple", | color="purple", | ||||
| linestyle="dotted", | linestyle="dotted", | ||||
| label="LTE RSRQ", | label="LTE RSRQ", | ||||
| ) | ) | ||||
| ax00.plot( | |||||
| nr_rsrq_plot = ax00.plot( | |||||
| transmission_df["NR5G_RSRQ_(dB)"].dropna(), | transmission_df["NR5G_RSRQ_(dB)"].dropna(), | ||||
| color="magenta", | color="magenta", | ||||
| linestyle="dotted", | linestyle="dotted", | ||||
| ax01.set_ylabel("Bandwidth [MHz]") | ax01.set_ylabel("Bandwidth [MHz]") | ||||
| if args.fancy: | if args.fancy: | ||||
| fig.legend(ncols=4, fontsize=12) | |||||
| # added these three lines | |||||
| lns_ax0 = snd_plot + srtt_plot + goodput_plot | |||||
| labs_ax0 = [l.get_label() for l in lns_ax0] | |||||
| ax0.legend(lns_ax0, labs_ax0, ncols=4, fontsize=12, loc="upper center") | |||||
| lns_ax00 = eff_bw_plot + lte_eff_bw_plot + nr_eff_bw_plot + lte_rsrq_plot + nr_rsrq_plot | |||||
| if lte_hanover_plot: | |||||
| lns_ax00.append(lte_hanover_plot) | |||||
| if nr_hanover_plot: | |||||
| lns_ax00.append(nr_hanover_plot) | |||||
| labs_ax00 = [l.get_label() for l in lns_ax0] | |||||
| ax00.legend(lns_ax00, labs_ax00, ncols=4, fontsize=12, loc="upper center") | |||||
| plt.savefig("{}{}_plot.eps".format(args.save, csv.replace(".csv", "")), bbox_inches="tight") | plt.savefig("{}{}_plot.eps".format(args.save, csv.replace(".csv", "")), bbox_inches="tight") | ||||
| else: | else: | ||||
| fig.legend(loc="lower right") | fig.legend(loc="lower right") |