Open2

Ping結果の可視化

mskz-3110mskz-3110
  • 目的
    • Ping結果を可視化することで環境の優劣や安定性を一目で判断できるようにしたい
    • Ping結果を1枚の画像で共有しやすくすることでPingを身近に感じて欲しい
mskz-3110mskz-3110
  • イメージ
import plotly.graph_objects as pgo

plot = [pgo.Scatter(mode = "lines", x = [1, 2, 3, 4, 5], y = [9, 12, 13, 10, 13])]
figure = pgo.Figure(data = plot)
figure.update_xaxes(dtick = 1, linecolor = "black", linewidth = 3, gridcolor = "black", griddash = "dot", mirror = True)
figure.update_yaxes(dtick = 1, linecolor = "black", linewidth = 3, gridcolor = "black", griddash = "dot", mirror = True)
figure.update_traces(line = dict(color = "skyblue", width = 5))
figure.update_layout(title = dict(text = "<b>[Ping]<br>A(Avg:12ms) rank</b>", font = dict(color = "skyblue", size = 26), x = 0.5),
  xaxis = dict(title = "Elapsed time(sec)"),
  yaxis = dict(title = "Round trip time(ms)"),
  font = dict(color = "black", size = 20),
  plot_bgcolor = "white")

figure.write_image("./sample.png", width = 800, height = 450)