Sfoglia il codice sorgente

Background color for cell id.

master
Lukas Prause 2 anni fa
parent
commit
481b6299f0
1 ha cambiato i file con 30 aggiunte e 25 eliminazioni
  1. +30
    -25
      plot_transmission_timeline.py

+ 30
- 25
plot_transmission_timeline.py Vedi File

@@ -187,8 +187,15 @@ if __name__ == "__main__":
plt.figure(figsize=[6.4 * scaley, 4.8 * scalex])
plt.title("{} with {}".format(transmission_direction, cc_algo))

host = host_subplot(111, axes_class=axisartist.Axes)
plt.subplots_adjust()
fig, ax = plt.subplots()
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
transmission_df["index"] = transmission_df.index
@@ -208,35 +215,33 @@ if __name__ == "__main__":
cmap = matplotlib.cm.get_cmap("Set3")
for c in transmission_df["cell_color"].unique():
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])


host.plot(transmission_df["goodput_rolling"], "-", color="blue", label="goodput")
host.set_xlabel("datetime")
host.set_ylabel("goodput [Mbps]")
host.set_ylim([0, 500])
ax.axvspan(bounds.min(), bounds.max(), alpha=0.3, color=cmap.colors[c])

# additional y axes
par11 = host.twinx()
par12 = host.twinx()
#par13 = host.twinx()
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")

# axes offset
par12.axis["right"] = par12.new_fixed_axis(loc="right", offset=(60, 0))
#par13.axis["right"] = par13.new_fixed_axis(loc="right", offset=(120, 0))
ax.set_xlim(transmission_df["index"].min(), transmission_df["index"].max())
ax.set_ylim(0, 500)
twin1.set_ylim(0, 15)
twin2.set_ylim(0, 1)

par11.axis["right"].toggle(all=True)
par12.axis["right"].toggle(all=True)
#par13.axis["right"].toggle(all=True)
ax.set_xlabel("Time")
ax.set_ylabel("Goodput")
twin1.set_ylabel("CQI")
twin2.set_ylabel("ACK RTT")

par11.plot(transmission_df["downlink_cqi"], "--", color="green", label="CQI")
par11.set_ylabel("CQI")
par11.set_ylim([0, 15])
ax.yaxis.label.set_color(p1.get_color())
twin1.yaxis.label.set_color(p2.get_color())
twin2.yaxis.label.set_color(p3.get_color())

par12.plot(transmission_df["ack_rtt"], "-.", color="red", label="ACK RTT")
par12.set_ylabel("ACK RTT [s]")
par12.set_ylim([0, 1])
tkw = dict(size=4, width=1.5)
ax.tick_params(axis='y', colors=p1.get_color(), **tkw)
twin1.tick_params(axis='y', colors=p2.get_color(), **tkw)
twin2.tick_params(axis='y', colors=p3.get_color(), **tkw)
ax.tick_params(axis='x', **tkw)

ax.legend(handles=[p1, p2, p3])

if args.save:
plt.savefig("{}timeline_plot.pdf".format(args.save))

Loading…
Annulla
Salva