I want to visualize world population by year using GeoPandas. This is the code I am using :
import matplotlib.ticker as ticker
import matplotlib.animation as animation
from IPython.display import HTML
fig,ax=plt.subplots(1,1,figsize=(15,5))
def animation_bar(year):
filtered=merged[merged['Year']==year]
filtered.plot(ax=ax,column='Population_x',legend=True,cmap='Reds')
animator=animation.FuncAnimation(fig,animation_bar,frames=merged['Year'].unique(),interval=1000)
HTML(animator.to_jshtml())
The output looks like this:
How to modify the code for proper result?