import matplotlib.pyplot as plt
plt.style.use('ggplot')
fig =plt.figure(figsize=(15,5)) #图像大小 figsize=(13,5)
ax = fig.add_subplot(111)
ax.plot(x, y, ls=":", marker='+',markersize=5,label = 'Tweets')
ax.plot(x, y1, ls="-.", marker='.',markersize=5,label = 'Thumbs up')
ax.plot(x, y2, ls=":", marker='*',markersize=5, label = 'Repost')
ax.plot(x, y3,ls="--", marker = "x",markersize=5, label = 'Comment')
# tempstd=df.groupby('day').std()['temperature']
# humstd=df.groupby('day').std()['humidity']
# ax.errorbar(x, y, fmt="g_:", yerr=rainstd/2, label = 'precipitation')
ax.set_xlabel("day")
ax.set_ylabel(r"Number")
plt.title("Discussion of trends from 2012 to 2020")#标题
# plt.grid()
totalSeed = x.tolist()
xticks=list(range(0,len(totalSeed),6))
xlabels=[totalSeed[x] for x in xticks]
xticks.append(len(totalSeed))
xlabels.append(totalSeed[-1])
ax.set_xticks(xticks)
ax.set_xticklabels(xlabels)
ax.set_xticklabels(labels=x) # 旋转90度
plt.legend()
plt.savefig('weibo2.svg',format='svg')
plt.show()