Skip to content
Snippets Groups Projects
Commit e2bbed4f authored by Tamas Gal's avatar Tamas Gal :speech_balloon:
Browse files

Set the limits on the x label to a fixed, configurable time range

parent 61f4cff9
No related branches found
No related tags found
No related merge requests found
...@@ -23,6 +23,7 @@ from collections import deque, defaultdict ...@@ -23,6 +23,7 @@ from collections import deque, defaultdict
from functools import partial from functools import partial
import io import io
import os import os
import time
import threading import threading
import numpy as np import numpy as np
...@@ -109,6 +110,9 @@ class CalibrateAHRS(kp.Module): ...@@ -109,6 +110,9 @@ class CalibrateAHRS(kp.Module):
print(self.__class__.__name__ + ": updating plot.") print(self.__class__.__name__ + ": updating plot.")
# xfmt = md.DateFormatter('%Y-%m-%d %H:%M') # xfmt = md.DateFormatter('%Y-%m-%d %H:%M')
xfmt = md.DateFormatter('%H:%M') xfmt = md.DateFormatter('%H:%M')
xlim = (datetime.utcfromtimestamp(time.time() -
self.time_range * 60 * 60),
datetime.utcnow())
for du in self.dus: for du in self.dus:
data = self.data[du] data = self.data[du]
for ahrs_param in data.keys(): for ahrs_param in data.keys():
...@@ -126,6 +130,7 @@ class CalibrateAHRS(kp.Module): ...@@ -126,6 +130,7 @@ class CalibrateAHRS(kp.Module):
marker='.', marker='.',
linestyle='none', linestyle='none',
label="Floor {}".format(floor)) label="Floor {}".format(floor))
ax.set_xlim(xlim)
lgd = plt.legend(bbox_to_anchor=(1.005, 1), lgd = plt.legend(bbox_to_anchor=(1.005, 1),
loc=2, loc=2,
borderaxespad=0.) borderaxespad=0.)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment