当我使用matplotlib创建图形时,Y轴摇杆处于无序状态,如下图所示:Show the error。如何解决此问题?我的代码来生成我的情节:
def create_graphe(data):
date = []
followers = []
following = []
ratio = []
for obj in data:
date.append(obj[0])
followers.append(obj[1])
following.append(obj[2])
ratio.append(obj[3])
plt.style.use('ggplot')
plt.subplot(3, 1, 1)
plt.plot(date,followers, label="Followers")
plt.xticks([])
plt.legend()
plt.subplot(3, 1, 2)
plt.plot(date,following, label="Following")
plt.xticks([])
plt.legend()
plt.subplot(3, 1, 3)
plt.plot(date,ratio, label="Ratio")
#plt.gca().invert_yaxis()
plt.xticks([])
plt.legend()
plt.show()