# Data Visualisation — How to Plot a Scatter Bubble Chart by Plotly Figure 1 A Scatter Bubble Chart of Life Expectancy versus GDP per capita (in log scale). Source of Data: Our World in Data
1. Install plotly and import plotly.express in Google Colab
`! pip install plotly==5.0.0import plotly.express as px`
`import pandas as pdfrom google.colab import drivedrive.mount('/content/drive/')data = pd.read_csv("drive/MyDrive/Colab Notebooks/life-expectancy-vs-gdp-per-capita.csv")data.head(5)`
`#define df2015 as the data of Year=2015df2015 = data.query("Year==2015")#plot the scatter plot by px of df2015 with x, y axis definedfig2015 = px.scatter(df2015, x="GDP per capita", y="Life expectancy")fig2015.show()` Figure 2 A scatterplot of life expectancy versus GDP per capita.
`df2015 = data.query("Year==2015")#just add log_x=True to convert x-axis to log scalefig2015 = px.scatter(df2015, x="GDP per capita", y="Life expectancy", log_x=True)fig2015.show()` Figure 3 A scatterplot of life expectancy versus GDP per capita in log scale — a stronger linear relationship is shown.
`df2015 = data.query("Year==2015")fig2015 = px.scatter(df2015, x="GDP per capita", y="Life expectancy", log_x=True, size="Total population", size_max=60, color="Continent", hover_name="Country")fig2015.show()` Figure 4 A scatter bubble chart of life expectancy versus GDP per capita in log scale — a stronger linear relationship is shown and the clusters of countries in different continents and their population sizes can easily be compared. Figure 5 Plotly Python Open Source graphing library basic charts. source https://plotly.com/python/basic-charts/ Figure 6 The Scatter Bubble Chart provided by Our World in Data webpage. https://ourworldindata.org/grapher/life-expectancy-vs-gdp-per-capita

--

--

--

## More from ecyY

ecyY — easy to understand why, easy to study why. Finding the truths scientifically is the theme.

Love podcasts or audiobooks? Learn on the go with our new app.

## How You Should Save the Output of your Spark ETL Jobs (If you are not Writing to a Database) ## When Less Data is Enough Data  ## BAYES’ THEOREM ## Obtain Content Domain Data In Just A Few Clicks ## Human(s)-in-the-Loop(s) of the Data Science Practice ## How to Go Beyond an Ordinary Data Scientist ## Enrich Hubspot Data With This API  ## ecyY

ecyY — easy to understand why, easy to study why. Finding the truths scientifically is the theme.

## Google Colab Recap for November ## Finding the Limit: Formula 1 Data Visualizations and Points Prediction ## Journey on My First Web Application for Geoscience. Things I Learned So Far (Part-2) ## Data Visualization Using Seaborn Library In Python. 