# HG changeset patch # User Daniel O'Connor # Date 1505135810 -34200 # Node ID 156ab071a9de389a3019d4988e973d968ae9be59 # Parent 227a2a524675762d1c665ac8cf2f7186cb3caecf Only print the start date if the duration is 1 day diff -r 227a2a524675 -r 156ab071a9de agl.py --- a/agl.py Mon Sep 11 22:46:37 2017 +0930 +++ b/agl.py Mon Sep 11 22:46:50 2017 +0930 @@ -280,7 +280,10 @@ ha = 'left', va = 'top') ndays = int(max(1, round(((end - start).total_seconds()) / 86400))) for ax in fig.get_axes(): - ax.set_title('%s to %s' % (startlt.strftime('%Y-%m-%d'), endlt.strftime('%Y-%m-%d'))) + if (endlt - startlt).total_seconds() > 86400: + ax.set_title('%s to %s' % (startlt.strftime('%Y-%m-%d'), endlt.strftime('%Y-%m-%d'))) + else: + ax.set_title('%s' % (startlt.strftime('%Y-%m-%d'))) ax.set_xlim([start, end]) ax.format_xdata = lambda d: matplotlib.dates.num2date(d).strftime('%d %b %H:%M') ax.xaxis.grid(True)