Skip to content
Myr

plot_histogram.py: add --type and --bins

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

authored by sharkdp · committed by sharkdp · parent dab1da9 · Browse files · 1 file+8 added−5 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+8 added−5 removed

  • other:+8 added−5 removed

1 file+8 added−5 removed

modified:scripts/plot_histogram.py+8 added-5 removed
8 unmodified lines
910parser = argparse.ArgumentParser(description=__doc__)11parser.add_argument("file", help="JSON file with benchmark results")12parser.add_argument("--title", help="Plot title")13parser.add_argument("--bins", help="Number of bins (default: auto)")14parser.add_argument(15 "--type", help="Type of histogram (*bar*, barstacked, step, stepfilled)"16)17args = parser.parse_args()1819with open(args.file) as f:20 results = json.load(f)["results"]
3 unmodified lines
2425t_min = np.min(list(map(np.min, all_times)))26t_max = np.max(list(map(np.max, all_times)))2728bins = int(args.bins) if args.bins else "auto"29histtype = args.type if args.type else "bar"3031plt.hist(25 all_times,26 label=commands,27 bins="auto",28 histtype="bar",29 range=(t_min, t_max),32 all_times, label=commands, bins=bins, histtype=histtype, range=(t_min, t_max),33)34plt.legend(prop={"family": ["Source Code Pro", "Fira Mono", "Courier New"]})3536plt.xlabel("Time [s]")
4 unmodified lines