From 74c5cecd452a39c0323660767aeef8e6f801350d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Sun, 15 Oct 2017 21:25:46 +0200 Subject: [PATCH] set appropriate xticks for datetimes --- eodb/events/management/commands/activity.py | 2 ++ eodb/events/management/commands/times.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/eodb/events/management/commands/activity.py b/eodb/events/management/commands/activity.py index 0c777f9..cd818fb 100644 --- a/eodb/events/management/commands/activity.py +++ b/eodb/events/management/commands/activity.py @@ -51,5 +51,7 @@ class Command(GraphCommand): values = [events[x] for x in dates] plt.bar(dates, values, width=20) + plt.gca().xaxis.set_major_locator(matplotlib.dates.YearLocator()) + plt.gca().xaxis.set_minor_locator(matplotlib.dates.MonthLocator()) plt.gca().xaxis.set_major_formatter(matplotlib.dates.DateFormatter('%m/%Y')) self.plot(options) diff --git a/eodb/events/management/commands/times.py b/eodb/events/management/commands/times.py index 28f73b9..8886983 100644 --- a/eodb/events/management/commands/times.py +++ b/eodb/events/management/commands/times.py @@ -19,6 +19,8 @@ class Command(GraphCommand): event_times.append(graph_date.hour + graph_date.minute / 60. + graph_date.second / 3600) plt.scatter(event_dates, event_times, alpha=0.3) + plt.gca().xaxis.set_major_locator(matplotlib.dates.YearLocator()) + 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))