def plotjoins(self, ctx):
"""Plots the joindates of everyone in the server"""
sm = ctx.message.server.members
x = sorted([m.joined_at for m in sm])
y = range(len(x))
plt.gca().xaxis.set_major_formatter(mdates.DateFormatter('%m/%d/%Y'))
plt.plot(x, y)
plt.gcf().autofmt_xdate()
plt.title("Plot of joins from {}".format(ctx.message.server.name))
buf = BytesIO()
plt.savefig(buf, format='png')
buf.seek(0)
await self.bot.upload(buf, filename='plot.png')
buf.close()
plt.close()
评论列表
文章目录