From ef1a59c429646f68149ad2ca0bb29b8f34ceffc1 Mon Sep 17 00:00:00 2001 From: jwansek Date: Thu, 8 Jun 2023 15:43:29 +0100 Subject: fixed plotter --- api_plotter.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api_plotter.py b/api_plotter.py index 83d4f08..ba197e2 100755 --- a/api_plotter.py +++ b/api_plotter.py @@ -32,7 +32,9 @@ for timestamp in timestamps: except KeyError: d[nearest] = 1 +d_sorted = {k: v for k, v in sorted(d.items(), key=lambda x: x[0])} + fig, ax = plt.subplots() -ax.plot(list(d.keys()), list(d.values())) +ax.plot(list(d_sorted.keys()), list(d_sorted.values())) plt.show() \ No newline at end of file -- cgit v1.2.3