def visualise(self, marks, counts):
N = len(marks)
ind = range(N)
_, ax = plt.subplots()
ax.bar(ind, counts, color='#4286f4')
ax.set_ylabel('Posts')
ax.set_xticks(ind)
ax.yaxis.set_major_locator(MaxNLocator(nbins=20, integer=True, min_n_ticks=1))
step = N // 12 + 1
labels = [self.format_time(mark) if i % step == 0 else '' for i, mark in enumerate(marks)]
ax.set_xticklabels(labels, rotation=45, fontsize=10)
return self.save()
评论列表
文章目录