Mercurial > ~darius > hgwebdir.cgi > agl
diff agl.py @ 3:525a66486282
Fix mouse hover formatting.
author | Daniel O'Connor <darius@dons.net.au> |
---|---|
date | Mon, 11 Sep 2017 11:32:52 +0930 |
parents | 2b7fb26f9114 |
children | deb3adc4e086 |
line wrap: on
line diff
--- a/agl.py Mon Sep 11 10:28:05 2017 +0930 +++ b/agl.py Mon Sep 11 11:32:52 2017 +0930 @@ -225,6 +225,7 @@ ndays = int(max(1, round(((end - start).total_seconds()) / 86400))) for ax in fig.get_axes(): ax.set_xlim([start, end]) + ax.format_xdata = lambda d: matplotlib.dates.num2date(d).strftime('%d %b %H:%M') ax.xaxis.grid(True) ax.xaxis.set_major_formatter(matplotlib.dates.DateFormatter('%d %b\n%H:%M')) ax.xaxis.set_major_locator(matplotlib.dates.HourLocator(interval = 2 * ndays))