fig, ax = plt.subplots()
for label, entry in data.items():
plt.plot(entry['x'], entry['y'], label = label)
- ax.legend(bbox_to_anchor = (1, 0.5), loc = 'center left')
+ legend = ax.legend(bbox_to_anchor = (1, 0.5), loc = 'center left')
plt.title(title)
plt.xlabel('Date')
dpi = 96
fig.set_size_inches(1024.0 / dpi, 768.0 / dpi)
b = io.BytesIO()
- plt.savefig(b, format = 'png', dpi = dpi)
+ plt.savefig(b, format = 'png', dpi = dpi, bbox_extra_artists = (legend, ), bbox_inches = 'tight')
b.seek(0)
await bot.say(destination, '', attachment = bot.parse_attachment(b.getvalue(), 'influence.png'))
return True