Bug fix: switch axis labels for correct heatmap display

Fixes nitred/nr-wg-mtu-finder:#5
pull/6/head
ahasbini 2 years ago
parent 2ee97d3f1b
commit 918ad85ce2

@ -9,22 +9,18 @@ def create_heatmap_from_log(log_filepath, heatmap_filepath):
df = pd.read_csv(log_filepath) df = pd.read_csv(log_filepath)
ax = axes[0, 0] ax = axes[0, 0]
dfx = df.pivot( dfx = df.pivot(index="server_mtu", columns="peer_mtu", values="upload_rcv_mbps")
index="server_mtu",
columns="peer_mtu",
values="upload_rcv_mbps",
)
sns.heatmap( sns.heatmap(
dfx.values, dfx.values,
linewidth=0.5, linewidth=0.5,
ax=ax, ax=ax,
cmap="Greens_r", cmap="Greens_r",
xticklabels=list(dfx.index), xticklabels=list(dfx.columns),
yticklabels=list(dfx.columns), yticklabels=list(dfx.index),
) )
ax.tick_params(axis="x", rotation=45) ax.tick_params(axis="x", rotation=45)
ax.tick_params(axis="y", rotation=0) ax.tick_params(axis="y", rotation=0)
ax.set(xlabel="Server MTU", ylabel="Peer MTU") ax.set(ylabel="Server MTU", xlabel="Peer MTU")
ax.set_title("Upload Rcv Bandwidth (Mbps)") ax.set_title("Upload Rcv Bandwidth (Mbps)")
ax.invert_yaxis() ax.invert_yaxis()
@ -35,12 +31,12 @@ def create_heatmap_from_log(log_filepath, heatmap_filepath):
linewidth=0.5, linewidth=0.5,
ax=ax, ax=ax,
cmap="Greens_r", cmap="Greens_r",
xticklabels=list(dfx.index), xticklabels=list(dfx.columns),
yticklabels=list(dfx.columns), yticklabels=list(dfx.index),
) )
ax.tick_params(axis="x", rotation=45) ax.tick_params(axis="x", rotation=45)
ax.tick_params(axis="y", rotation=0) ax.tick_params(axis="y", rotation=0)
ax.set(xlabel="Server MTU", ylabel="Peer MTU") ax.set(ylabel="Server MTU", xlabel="Peer MTU")
ax.set_title("Upload Send Bandwidth (Mbps)") ax.set_title("Upload Send Bandwidth (Mbps)")
ax.invert_yaxis() ax.invert_yaxis()
@ -51,12 +47,12 @@ def create_heatmap_from_log(log_filepath, heatmap_filepath):
linewidth=0.5, linewidth=0.5,
ax=ax, ax=ax,
cmap="Greens_r", cmap="Greens_r",
xticklabels=list(dfx.index), xticklabels=list(dfx.columns),
yticklabels=list(dfx.columns), yticklabels=list(dfx.index),
) )
ax.tick_params(axis="x", rotation=45) ax.tick_params(axis="x", rotation=45)
ax.tick_params(axis="y", rotation=0) ax.tick_params(axis="y", rotation=0)
ax.set(xlabel="Server MTU", ylabel="Peer MTU") ax.set(ylabel="Server MTU", xlabel="Peer MTU")
ax.set_title("Download Rcv Bandwidth (Mbps)") ax.set_title("Download Rcv Bandwidth (Mbps)")
ax.invert_yaxis() ax.invert_yaxis()
@ -67,12 +63,12 @@ def create_heatmap_from_log(log_filepath, heatmap_filepath):
linewidth=0.5, linewidth=0.5,
ax=ax, ax=ax,
cmap="Greens_r", cmap="Greens_r",
xticklabels=list(dfx.index), xticklabels=list(dfx.columns),
yticklabels=list(dfx.columns), yticklabels=list(dfx.index),
) )
ax.tick_params(axis="x", rotation=45) ax.tick_params(axis="x", rotation=45)
ax.tick_params(axis="y", rotation=0) ax.tick_params(axis="y", rotation=0)
ax.set(xlabel="Server MTU", ylabel="Peer MTU") ax.set(ylabel="Server MTU", xlabel="Peer MTU")
ax.set_title("Download Send Bandwidth (Mbps)") ax.set_title("Download Send Bandwidth (Mbps)")
ax.invert_yaxis() ax.invert_yaxis()

Loading…
Cancel
Save