diff options
author | David Peter <mail@david-peter.de> | 2023-04-17 22:27:28 +0200 |
---|---|---|
committer | David Peter <david.peter@bosch.com> | 2023-04-17 22:27:28 +0200 |
commit | 77e7b6cd65a15da46bf8ae3e28f12dc166505d6f (patch) | |
tree | e51dd23599aae134abdf4b164ca7fe6dfbea7c19 | |
parent | 7684efdd2dc342f4671be7c6a0fc75bc4054bf96 (diff) |
Add --log-count option to plot_histogram.pylog-count
-rwxr-xr-x | scripts/plot_histogram.py | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/scripts/plot_histogram.py b/scripts/plot_histogram.py index b084def..9700b90 100755 --- a/scripts/plot_histogram.py +++ b/scripts/plot_histogram.py @@ -17,15 +17,18 @@ parser.add_argument("--bins", help="Number of bins (default: auto)") parser.add_argument( "--type", help="Type of histogram (*bar*, barstacked, step, stepfilled)" ) -parser.add_argument( - "-o", "--output", help="Save image to the given filename." -) +parser.add_argument("-o", "--output", help="Save image to the given filename.") parser.add_argument( "--t-min", metavar="T", help="Minimum time to be displayed (seconds)" ) parser.add_argument( "--t-max", metavar="T", help="Maximum time to be displayed (seconds)" ) +parser.add_argument( + "--log-count", + help="Use a logarithmic y-axis for the event count", + action="store_true", +) args = parser.parse_args() @@ -45,7 +48,11 @@ bins = int(args.bins) if args.bins else "auto" histtype = args.type if args.type else "bar" plt.hist( - all_times, label=labels, bins=bins, histtype=histtype, range=(t_min, t_max), + all_times, + label=labels, + bins=bins, + histtype=histtype, + range=(t_min, t_max), ) plt.legend(prop={"family": ["Source Code Pro", "Fira Mono", "Courier New"]}) @@ -53,6 +60,11 @@ plt.xlabel("Time [s]") if args.title: plt.title(args.title) +if args.log_count: + plt.yscale("log") +else: + plt.ylim(0, None) + if args.output: plt.savefig(args.output) else: |