Background color for cell id.

This commit is contained in:
Lukas Prause
2023-01-19 15:10:05 +01:00
parent 295b21fac7
commit 481b6299f0

View File

@@ -187,8 +187,15 @@ if __name__ == "__main__":
plt.figure(figsize=[6.4 * scaley, 4.8 * scalex]) plt.figure(figsize=[6.4 * scaley, 4.8 * scalex])
plt.title("{} with {}".format(transmission_direction, cc_algo)) plt.title("{} with {}".format(transmission_direction, cc_algo))
host = host_subplot(111, axes_class=axisartist.Axes) fig, ax = plt.subplots()
plt.subplots_adjust() fig.subplots_adjust(right=0.75)
twin1 = ax.twinx()
twin2 = ax.twinx()
# Offset the right spine of twin2. The ticks and label have already been
# placed on the right by twinx above.
twin2.spines.right.set_position(("axes", 1.2))
# create list fo color indices # create list fo color indices
transmission_df["index"] = transmission_df.index transmission_df["index"] = transmission_df.index
@@ -208,35 +215,33 @@ if __name__ == "__main__":
cmap = matplotlib.cm.get_cmap("Set3") cmap = matplotlib.cm.get_cmap("Set3")
for c in transmission_df["cell_color"].unique(): for c in transmission_df["cell_color"].unique():
bounds = transmission_df[["index", "cell_color"]].groupby("cell_color").agg(["min", "max"]).loc[c] bounds = transmission_df[["index", "cell_color"]].groupby("cell_color").agg(["min", "max"]).loc[c]
host.axvspan(bounds.min(), bounds.max(), alpha=0.3, color=cmap.colors[c]) ax.axvspan(bounds.min(), bounds.max(), alpha=0.3, color=cmap.colors[c])
p1, = ax.plot(transmission_df["goodput_rolling"], "-", color="blue", label="goodput")
p2, = twin1.plot(transmission_df["downlink_cqi"], "--", color="green", label="CQI")
p3, = twin2.plot(transmission_df["ack_rtt"], "-.", color="red", label="ACK RTT")
host.plot(transmission_df["goodput_rolling"], "-", color="blue", label="goodput") ax.set_xlim(transmission_df["index"].min(), transmission_df["index"].max())
host.set_xlabel("datetime") ax.set_ylim(0, 500)
host.set_ylabel("goodput [Mbps]") twin1.set_ylim(0, 15)
host.set_ylim([0, 500]) twin2.set_ylim(0, 1)
# additional y axes ax.set_xlabel("Time")
par11 = host.twinx() ax.set_ylabel("Goodput")
par12 = host.twinx() twin1.set_ylabel("CQI")
#par13 = host.twinx() twin2.set_ylabel("ACK RTT")
# axes offset ax.yaxis.label.set_color(p1.get_color())
par12.axis["right"] = par12.new_fixed_axis(loc="right", offset=(60, 0)) twin1.yaxis.label.set_color(p2.get_color())
#par13.axis["right"] = par13.new_fixed_axis(loc="right", offset=(120, 0)) twin2.yaxis.label.set_color(p3.get_color())
par11.axis["right"].toggle(all=True) tkw = dict(size=4, width=1.5)
par12.axis["right"].toggle(all=True) ax.tick_params(axis='y', colors=p1.get_color(), **tkw)
#par13.axis["right"].toggle(all=True) twin1.tick_params(axis='y', colors=p2.get_color(), **tkw)
twin2.tick_params(axis='y', colors=p3.get_color(), **tkw)
par11.plot(transmission_df["downlink_cqi"], "--", color="green", label="CQI") ax.tick_params(axis='x', **tkw)
par11.set_ylabel("CQI")
par11.set_ylim([0, 15])
par12.plot(transmission_df["ack_rtt"], "-.", color="red", label="ACK RTT")
par12.set_ylabel("ACK RTT [s]")
par12.set_ylim([0, 1])
ax.legend(handles=[p1, p2, p3])
if args.save: if args.save:
plt.savefig("{}timeline_plot.pdf".format(args.save)) plt.savefig("{}timeline_plot.pdf".format(args.save))