Adds fancy legend.

This commit is contained in:
Lukas Prause
2023-07-10 16:01:57 +02:00
parent 75be22b719
commit 70a1e5b82e

View File

@@ -10,6 +10,7 @@ import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()
tex_fonts = {
@@ -25,6 +26,7 @@ tex_fonts = {
"mathtext.fontset": "dejavusans",
}
# plt.rcParams.update(tex_fonts)
@@ -89,7 +91,7 @@ if __name__ == "__main__":
transmission_df = transmission_df.sort_index()
# srtt to [s]
transmission_df["srtt"] = transmission_df["srtt"].apply(lambda x: x / 10**6)
transmission_df["srtt"] = transmission_df["srtt"].apply(lambda x: x / 10 ** 6)
# key for columns and level for index
transmission_df["goodput"] = (
@@ -98,14 +100,14 @@ if __name__ == "__main__":
.transform("sum")
)
transmission_df["goodput"] = transmission_df["goodput"].apply(
lambda x: ((x * 8) / args.interval) / 10**6
lambda x: ((x * 8) / args.interval) / 10 ** 6
)
transmission_df["goodput_rolling"] = (
transmission_df["payload_size"].rolling("{}s".format(args.interval)).sum()
)
transmission_df["goodput_rolling"] = transmission_df["goodput_rolling"].apply(
lambda x: ((x * 8) / args.interval) / 10**6
lambda x: ((x * 8) / args.interval) / 10 ** 6
)
# set meta values and remove all not needed columns
@@ -178,7 +180,8 @@ if __name__ == "__main__":
+ transmission_df["LTE_bw"].fillna(0))
transmission_df["nr_effective_bw_sum"] = transmission_df["SCC1_NR5G_effective_bw"]
transmission_df["effective_bw_sum"] = transmission_df["nr_effective_bw_sum"] + transmission_df["lte_effective_bw_sum"]
transmission_df["effective_bw_sum"] = transmission_df["nr_effective_bw_sum"] + transmission_df[
"lte_effective_bw_sum"]
# transmission timeline
scaley = 1.5
@@ -309,16 +312,19 @@ if __name__ == "__main__":
ax01.set_ylabel("Bandwidth [MHz]")
if args.fancy:
ax0.set_xlim([0, transmission_df.index[-1]])
ax00.set_xlim([0, transmission_df.index[-1]])
# 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]
labs_ax00 = [l.get_label() for l in labs_ax00]
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")
else: