1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
import plotly.graph_objects as go
from plotly.subplots import make_subplots
def plot_results(results, filename):
fig = make_subplots(rows=len(results), cols=1, shared_xaxes=True)
for i, (coro_name, x_values) in enumerate(results.items(), start=1):
x_list = []
y_list = []
hover_text = []
for speedup, experiments in x_values.items():
for experiment in experiments:
y_value = sum(experiment.values())
x_list.append(speedup)
y_list.append(y_value)
breakdown = "<br>".join([f" {key[0]} ({key[1]}): {round(value, 4)}" for key, value in experiment.items()])
hover_text.append(f"{coro_name}<br>Speedup: {speedup}<br>Total Wait: {round(y_value, 4)}<br>Breakdown:<br>{breakdown}")
fig.add_trace(go.Scatter(
x=x_list,
y=y_list,
mode='markers',
name=coro_name,
hoverinfo='text',
hovertext=hover_text,
))
fig.update_layout(
title="Potential Speedups for ",
xaxis_title="Speedup (times faster)",
yaxis_title="Total Wait (seconds)",
showlegend=True,
)
fig.write_html(filename)
|