Skip to content
Snippets Groups Projects
Verified Commit 3af5531d authored by Sebastian Endres's avatar Sebastian Endres
Browse files

Different colors for cross-tests and not-cross-tests

parent 0167c53f
Branches
No related tags found
No related merge requests found
%% Cell type:code id:46f15e96 tags: %% Cell type:code id:46f15e96 tags:
``` python ``` python
from result_parser import Result from result_parser import Result
from matplotlib import pyplot as plt from matplotlib import pyplot as plt
from ipywidgets import interact, interactive, fixed, interact_manual from ipywidgets import interact, interactive, fixed, interact_manual
import ipywidgets as widgets import ipywidgets as widgets
result = Result("./result.json") result = Result("./result.json")
print(result) print(result)
``` ```
%% Cell type:code id:fb2ea311 tags: %% Cell type:code id:fb2ea311 tags:
``` python ``` python
@interact(sort_key=widgets.Dropdown( @interact(sort_key=widgets.Dropdown(
options=['avg', 'var'], options=['avg', 'var'],
value='avg', value='avg',
description='Sort by:', description='Sort by:',
disabled=False, disabled=False,
)) ))
def plot(sort_key): def plot(sort_key):
sat_tests = sorted( sat_tests = sorted(
result.get_all_measuements_of_type("SAT", succeeding=True), result.get_all_measuements_of_type("SAT", succeeding=True),
key=lambda m: getattr(m, sort_key), key=lambda m: getattr(m, sort_key),
) )
units = [test.unit for test in sat_tests] units = [test.unit for test in sat_tests]
assert all((unit == units[0] for unit in units)) assert all((unit == units[0] for unit in units))
unit = units[0] unit = units[0]
plt.rcParams["figure.figsize"] = 15, 15 plt.rcParams["figure.figsize"] = 15, 15
fig, ax = plt.subplots() fig, ax = plt.subplots()
barh = ax.barh( barh = ax.barh(
[test.combination for test in sat_tests], [test.combination for test in sat_tests],
[test.avg for test in sat_tests], [test.avg for test in sat_tests],
# xerr=[test.var for test in sat_tests], # xerr=[test.var for test in sat_tests],
align="center", align="center",
color="#3465A4", color=["#3465A4" if test.server.name == test.client.name else "#888" for test in sat_tests],
) )
ax.errorbar( ax.errorbar(
x=[test.avg for test in sat_tests], x=[test.avg for test in sat_tests],
y=[test.combination for test in sat_tests], y=[test.combination for test in sat_tests],
xerr=[test.var for test in sat_tests], xerr=[test.var for test in sat_tests],
lw = 2, lw = 2,
capsize=4, capsize=4,
capthick=4, capthick=4,
color="red", color="red",
fmt="none", fmt="none",
) )
ax.bar_label( ax.bar_label(
container=barh, container=barh,
labels=[test.details for test in sat_tests], labels=[test.details for test in sat_tests],
color="#fff", color="#fff",
label_type="center", label_type="center",
) )
ax.set_xlabel(f"Goodput ({unit})") ax.set_xlabel(f"Goodput ({unit})")
ax.set_title("SAT Goodput Measurement Results of Succeeding Combinations") ax.set_title("SAT Goodput Measurement Results of Succeeding Combinations")
ax.xaxis.grid(True) ax.xaxis.grid(True)
plt.show() plt.show()
``` ```
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment