Dropdown Economic#
Download this notebook from GitHub (right-click to download).
Most examples work across multiple plotting backends, this example is also available for:
import pandas as pd
import holoviews as hv
from holoviews import opts, dim
hv.extension('bokeh')
Declaring data#
macro_df = pd.read_csv('http://assets.holoviews.org/macro.csv', delimiter='\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#
gdp_curves = macro.to.curve('Year', 'GDP Growth')
gdp_unem_scatter = macro.to.scatter('Year', ['GDP Growth', 'Unemployment'])
annotations = hv.Arrow(1973, 8, 'Oil Crisis', 'v') * hv.Arrow(1975, 6, 'Stagflation', 'v') *\
hv.Arrow(1979, 8, 'Energy Crisis', 'v') * hv.Arrow(1981.9, 5, 'Early Eighties\n Recession', 'v')
(gdp_curves * gdp_unem_scatter* annotations).opts(
opts.Curve(color='k'),
opts.Scatter(cmap='Blues', color='Unemployment',
line_color='k', size=dim('Unemployment')*1.5),
opts.Text(text_font_size='13px'),
opts.Overlay(height=400, show_frame=False, width=700))
This web page was generated from a Jupyter notebook and not all interactivity will work on this website. Right click to download and run locally for full Python-backed interactivity.
Download this notebook from GitHub (right-click to download).