The article provides a tutorial for creating an animated bubble chart using Plotly in Python, inspired by professor Hans Rosling.
Abstract
The tutorial showcases how to create an animated bubble chart in Plotly using Python, using GDP per Capita vs Life Expectancy as an example. The process involves data preparation, merging datasets, and animation using Plotly. Express library. The final product is an interactive chart with customizable features such as titles, axis labels, and background colors.
Opinions
The author is inspired by professor Hans Rosling, who was known for his powerful and attractive animated charts in his TED talks.
The author believes that the dataset doesn't have enough information and needs to merge it with another dataset that includes continent information.
The author suggests customizing the chart further with proper titles, axis labels, and background colors for a more visually appealing chart.
The author recommends checking out their other posts for other types of beautiful charts that can be made using Plotly in Python.
The author promotes an AI service that is more cost-effective than ChatGPT Plus but provides the same performance and functions.
Make an impressive animated bubble chart with Plotly in Python — inspired by professor Hans Rosling
This tutorial is inspired by professor Hans Rosling, who was a Swedish physician, academic, and public speaker. He provided many amazing TED talks regarding population, poverty, life expectancy, etc. All the animated charts in his talks are very attractive and powerful to convey the ideas.
The animated chart I am going to generate here is GDP per Capita vs Life Expectancy. And I am going to use Ploy.Express library to create the chart and it only requires a few lines. Then you will get the animated bubble chart like this,
Part 1: Data preparation
In this part, I am going to show how I prepare data in detailed steps. If you want to skip this part, you can directly go to the Part 2. Data Animation.
#import libraries
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
import plotly.express as px
I get the data from the website called Our World in Data. You can download the data in csv format the then import the data.