times: shift times to have a continuous past-midnight view
This commit is contained in:
parent
01a3c60ceb
commit
b5a4939646
|
@ -1,3 +1,5 @@
|
|||
import datetime
|
||||
|
||||
import matplotlib
|
||||
import matplotlib.dates
|
||||
import matplotlib.pyplot as plt
|
||||
|
@ -21,6 +23,7 @@ class Command(GraphCommand):
|
|||
for i, (legend, serie) in enumerate(self.get_series(options)):
|
||||
for commit in serie:
|
||||
graph_date = getattr(commit, datetime_var)
|
||||
graph_date -= datetime.timedelta(hours=4)
|
||||
event_dates.append(matplotlib.dates.date2num(graph_date.date()))
|
||||
event_times.append(graph_date.hour + graph_date.minute / 60. + graph_date.second / 3600)
|
||||
plot = plt.scatter(event_dates, event_times, alpha=options.get('opacity'))
|
||||
|
@ -34,5 +37,5 @@ class Command(GraphCommand):
|
|||
plt.gca().xaxis.set_minor_locator(matplotlib.dates.MonthLocator())
|
||||
plt.gca().xaxis.set_major_formatter(matplotlib.dates.DateFormatter('%m/%Y'))
|
||||
plt.gca().set_ylim([0, 24])
|
||||
plt.yticks(range(24))
|
||||
plt.yticks(range(24), list(range(4, 24)) + list(range(0, 4)))
|
||||
self.plot(options)
|
||||
|
|
Reference in New Issue