comparison 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
comparison
equal deleted inserted replaced
2:2b7fb26f9114 3:525a66486282
223 ax2.legend(loc = 'upper right') 223 ax2.legend(loc = 'upper right')
224 224
225 ndays = int(max(1, round(((end - start).total_seconds()) / 86400))) 225 ndays = int(max(1, round(((end - start).total_seconds()) / 86400)))
226 for ax in fig.get_axes(): 226 for ax in fig.get_axes():
227 ax.set_xlim([start, end]) 227 ax.set_xlim([start, end])
228 ax.format_xdata = lambda d: matplotlib.dates.num2date(d).strftime('%d %b %H:%M')
228 ax.xaxis.grid(True) 229 ax.xaxis.grid(True)
229 ax.xaxis.set_major_formatter(matplotlib.dates.DateFormatter('%d %b\n%H:%M')) 230 ax.xaxis.set_major_formatter(matplotlib.dates.DateFormatter('%d %b\n%H:%M'))
230 ax.xaxis.set_major_locator(matplotlib.dates.HourLocator(interval = 2 * ndays)) 231 ax.xaxis.set_major_locator(matplotlib.dates.HourLocator(interval = 2 * ndays))
231 ax.xaxis.set_minor_locator(matplotlib.dates.MinuteLocator(interval = 5 * ndays)) 232 ax.xaxis.set_minor_locator(matplotlib.dates.MinuteLocator(interval = 5 * ndays))
232 for label in ax.get_xticklabels(): 233 for label in ax.get_xticklabels():