From 4f025221668fc31584cf1df30c78d325b60133d9 Mon Sep 17 00:00:00 2001 From: Enrico Lumetti Date: Fri, 17 Sep 2021 23:50:53 +0200 Subject: [PATCH] Better histogram --- main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 2093118..0084f93 100755 --- a/main.py +++ b/main.py @@ -75,7 +75,9 @@ else: num_buckets = (max_date - min_date).total_seconds() / (bucket_size * 3600) num_buckets = max(1, int(num_buckets)) counts, bin_edges = np.histogram(timestamps, bins=num_buckets) + ts_edges = [datetime.fromtimestamp(t) for t in bin_edges] + labels = [x[0].strftime('%Y-%m-%d %H:%M - ') + x[1].strftime('%Y-%m-%d %H:%M') for x in zip(ts_edges[:-1], ts_edges[1:])] fig = tpl.figure() - fig.hist(counts, bin_edges) + fig.barh(counts, labels) fig.show()