Scatter economic

Download this notebook from GitHub (right-click to download).


Most examples work across multiple plotting backends, this example is also available for:

In [1]:
import pandas as pd
import holoviews as hv
from holoviews import dim, opts

hv.extension('matplotlib')
hv.output(dpi=100)

Declaring data

In [2]:
macro_df = pd.read_csv('http://assets.holoviews.org/macro.csv', '\t')
key_dimensions   = [('year', 'Year'), ('country', 'Country')]
value_dimensions = [('unem', 'Unemployment'), ('capmob', 'Capital Mobility'),
                    ('gdp', 'GDP Growth'), ('trade', 'Trade')]
macro = hv.Table(macro_df, key_dimensions, value_dimensions)

Plot

In [3]:
gdp_unem_scatter = macro.to.scatter('Year', ['GDP Growth', 'Unemployment'])
gdp_unem_scatter.overlay('Country').opts(
    opts.Scatter(color=hv.Cycle('tab20'), edgecolors='k', show_grid=True,
                 aspect=2, fig_size=250, s=dim('Unemployment')*20,
                 padding=0.1, show_frame=False),
    opts.NdOverlay(legend_position='right'))
Out[3]:

Download this notebook from GitHub (right-click to download).