以下数据集需要以年份作为气泡图.随着年份的推移,预期生命周期 (X轴)和GDP(Y轴)需要改变.
df.head()
下图为1960年:
下图为1961年:
我的要求是绘制预期生命周期 与GDP的关系图以及年份.
fig, ax = plt.subplots()
s = ax.scatter([], [])
def animate_(i):
# clear the axis each frame
ax.clear()
# replot things
s = ax.scatter("LifeExpectency",
"GDP_in_log2",
alpha=0.5,
s='population',
c='colorForContinent',
data = df)
return s,
anim = FuncAnimation(fig, animate_, frames = 62 , interval=500, blit=False)
#anim.save('Countries progression.mp4')
Following the image i got. It means all the year output merge one another. Any idea how to sort this out.