comparison graph.py @ 9:899bc9c22787

Tweak annotation to be out of the way
author Daniel O'Connor <darius@dons.net.au>
date Fri, 22 Dec 2017 13:11:23 +0100
parents 30e7adf283ca
children 3f5b617b4715
comparison
equal deleted inserted replaced
8:30e7adf283ca 9:899bc9c22787
213 annotations.append(line.annotation) 213 annotations.append(line.annotation)
214 214
215 ax2.legend(loc = 'upper right') 215 ax2.legend(loc = 'upper right')
216 216
217 if len(annotations) > 0: 217 if len(annotations) > 0:
218 ax1.text(0.02, 0.9, reduce(lambda a, b: a + '\n' + b, annotations), 218 ax1.text(0.02, 0.5, reduce(lambda a, b: a + '\n' + b, annotations),
219 transform = ax1.transAxes, bbox = dict(facecolor = 'red', alpha = 0.5), 219 transform = ax1.transAxes, bbox = dict(facecolor = 'blue', alpha = 0.5),
220 ha = 'left', va = 'top') 220 ha = 'left', va = 'top')
221 ndays = int(max(1, round((end - start) / 86400))) 221 ndays = int(max(1, round((end - start) / 86400)))
222 for ax in fig.get_axes(): 222 for ax in fig.get_axes():
223 if (enddt - startdt).total_seconds() > 86400: 223 if (enddt - startdt).total_seconds() > 86400:
224 ax.set_title('%s to %s' % (startdt.strftime('%Y-%m-%d'), enddt.strftime('%Y-%m-%d'))) 224 ax.set_title('%s to %s' % (startdt.strftime('%Y-%m-%d'), enddt.strftime('%Y-%m-%d')))