In [ ]:
from bqplot import (
    Figure, Map, Mercator, Orthographic, ColorScale, ColorAxis,
    AlbersUSA, topo_load, Tooltip
)

Basic Map


In [ ]:
sc_geo = Mercator()
map_mark = Map(scales={'projection': sc_geo})
Figure(marks=[map_mark], title='Basic Map Example')

Advanced Map and Projection


In [ ]:
sc_geo = Orthographic(scale_factor=375, center=[0, 25], rotate=(-50, 0))
map_mark = Map(map_data=topo_load('map_data/WorldMap.json'), scales={'projection': sc_geo}, 
        colors={682: 'Green', 356: 'Red', 643: '#0000ff', 'default_color': 'DarkOrange'})
Figure(marks=[map_mark], fig_color='deepskyblue', title='Advanced Map Example')

In [ ]:
sc_geo.scale = 350

Choropleth


In [ ]:
sc_geo = Mercator()
sc_c1 = ColorScale(scheme='YlOrRd')

map_styles = {'color': {643: 105., 4: 21., 398: 23., 156: 42., 124:78., 76: 98.},
              'scales': {'projection': sc_geo, 'color': sc_c1}, 'colors': {'default_color': 'Grey'}}

axis = ColorAxis(scale=sc_c1)

chloro_map = Map(map_data=topo_load('map_data/WorldMap.json'), **map_styles)
Figure(marks=[chloro_map], axes=[axis],title='Choropleth Example')

USA State Map


In [ ]:
sc_geo = AlbersUSA()
states_map = Map(map_data=topo_load('map_data/USStatesMap.json'), scales={'projection': sc_geo})
Figure(marks=[states_map], title='US States Map Example')

Europe Country Map


In [ ]:
sc_geo = Mercator(scale_factor=450)
euro_map = Map(map_data=topo_load('map_data/EuropeMap.json'), 
            scales={'projection': sc_geo})
Figure(marks=[euro_map], title='Europe States Map Example')

Interactions


In [ ]:
def_tt = Tooltip(fields=['id', 'name'])
map_mark = Map(scales={'projection': Mercator()}, tooltip=def_tt)
map_mark.interactions = {'click': 'select', 'hover': 'tooltip'}
Figure(marks=[map_mark], title='Interactions Example')

In [ ]: