Skip to content
Myr

Add --log-count option to plot_histogram.py

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

authored by David Peter · committed by David Peter · parent 7684efd · Browse files · 1 file+16 added−4 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+16 added−4 removed

  • other:+16 added−4 removed

1 file+16 added−4 removed

modified:scripts/plot_histogram.py+16 added-4 removed
15 unmodified lines
16parser.add_argument("--bins", help="Number of bins (default: auto)")17parser.add_argument(18 "--type", help="Type of histogram (*bar*, barstacked, step, stepfilled)"19)20parser.add_argument("-o", "--output", help="Save image to the given filename.")21parser.add_argument(21 "-o", "--output", help="Save image to the given filename."22)23parser.add_argument(22 "--t-min", metavar="T", help="Minimum time to be displayed (seconds)"23)24parser.add_argument(25 "--t-max", metavar="T", help="Maximum time to be displayed (seconds)"26)27parser.add_argument(28 "--log-count",29 help="Use a logarithmic y-axis for the event count",30 action="store_true",31)3233args = parser.parse_args()3435with open(args.file) as f:
11 unmodified lines
47bins = int(args.bins) if args.bins else "auto"48histtype = args.type if args.type else "bar"4950plt.hist(48 all_times, label=labels, bins=bins, histtype=histtype, range=(t_min, t_max),51 all_times,52 label=labels,53 bins=bins,54 histtype=histtype,55 range=(t_min, t_max),56)57plt.legend(prop={"family": ["Source Code Pro", "Fira Mono", "Courier New"]})5859plt.xlabel("Time [s]")60if args.title:61 plt.title(args.title)6263if args.log_count:64 plt.yscale("log")65else:66 plt.ylim(0, None)6768if args.output:69 plt.savefig(args.output)70else:71 plt.show()