Skip to content

Commit 38f7730

Browse files
Jason LeakeJason Leake
Jason Leake
authored and
Jason Leake
committed
Improve plotting
1 parent 78f4492 commit 38f7730

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

ax3_wearing.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
import os
5353
import sys
5454
import tkinter as tk
55+
import matplotlib.ticker as ticker
5556

5657
class Processor:
5758

@@ -80,18 +81,22 @@ def _plot(self, plotFilename,
8081

8182
# Index 0 of data is epoch time
8283
seconds = mdate.epoch2num(epochTimestamps)
83-
print(seconds)
84+
8485
dateFormat = "%H:%M"
8586
dateFormatter = mdate.DateFormatter(dateFormat)
86-
locator = mdate.HourLocator(interval=6)
87+
if len(seconds) > 12 * 60 * 60:
88+
locator = mdate.HourLocator(interval=6)
89+
else:
90+
print("Less than 12 hours")
91+
locator = mdate.HourLocator(interval=1)
8792
locator.MAXTICKS = 5000
8893

8994
fig, axis = plt.subplots(3)
9095

9196
for index in range(3):
9297
axis[index].grid(True)
9398
axis[index].xaxis.set_major_locator(locator)
94-
axis[index].xaxis.set_minor_locator(mdate.HourLocator())
99+
axis[index].xaxis.set_minor_locator(ticker.NullLocator())
95100
axis[index].xaxis.set_major_formatter(dateFormatter)
96101
axis[index].set_xlabel("Time")
97102

0 commit comments

Comments
 (0)