Skip to content
Myr

Update plot_whisker.py

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Eugene Obrezkov · committed by David Peter · parent 2f8dd1a · Browse files · 1 file+12 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+12 added−2 removed

  • other:+12 added−2 removed

1 file+12 added−2 removed

modified:scripts/plot_whisker.py+12 added-2 removed
8 unmodified lines
9"""1011import argparse12import json13import numpy as np14import matplotlib.pyplot as plt15import matplotlib.cm as cm1617parser = argparse.ArgumentParser(description=__doc__)18parser.add_argument("file", help="JSON file with benchmark results")19parser.add_argument("--title", help="Plot Title")20args = parser.parse_args()2122with open(args.file) as f:23 results = json.load(f)["results"]2425commands = [b["command"] for b in results]26times = [b["times"] for b in results]2725plt.boxplot(times, labels=commands)28boxplot = plt.boxplot(times, vert=True, patch_artist=True)29cmap = plt.cm.get_cmap("rainbow")30colors = [cmap(val / len(times)) for val in range(len(times))]3132for patch, color in zip(boxplot["boxes"], colors):33 patch.set_facecolor(color)3435plt.title(args.title)36plt.legend(handles=boxplot["boxes"], labels=commands, loc="best", fontsize="medium")37plt.ylabel("Time [s]")27plt.ylim(0, None)38plt.show()