Show Sidebar Hide Sidebar

Bubble Charts in Pandas

How to make a bubble chart in pandas. Examples of scatter charts whose markers have variable color, size, and symbols.

# Learn about API authentication here:
# Find your api_key here:
# Cufflinks binds plotly to pandas dataframes in IPython notebook. Read more

import plotly.plotly as py
import cufflinks as cf
import pandas as pd

cf.set_config_file(offline=False, world_readable=True, theme='pearl')

df = pd.read_csv('', sep='\t')
df2007 = df[df.year==2007]

df2007.iplot(kind='bubble', x='gdpPercap', y='lifeExp', size='pop', text='country',
             xTitle='GDP per Capita', yTitle='Life Expectancy',
Still need help?
Contact Us

For guaranteed 24 hour response turnarounds, upgrade to a Developer Support Plan.