In [2]:
import vincent
vincent.core.initialize_notebook()
In [2]:
list_data = [10, 20, 30, 20, 15, 30, 45]
bar = vincent.Bar(list_data)
bar.display() # each time you type this, the graph appears
In [3]:
world_topo = r'world-countries.topo.json'
geo_data = [{'name': 'countries',
'url': world_topo,
'feature': 'world-countries'}]
vis = vincent.Map(geo_data=geo_data, scale=200)
vis.display()
In [4]:
county_topo = r'us_counties.topo.json'
state_topo = r'us_states.topo.json'
geo_data = [{'name': 'counties',
'url': county_topo,
'feature': 'us_counties.geo'},
{'name': 'states',
'url': state_topo,
'feature': 'us_states.geo'}]
vis = vincent.Map(geo_data=geo_data, scale=1000, projection='albersUsa')
del vis.marks[1].properties.update
vis.marks[0].properties.update.fill.value = '#084081'
vis.marks[1].properties.enter.stroke.value = '#fff'
vis.marks[0].properties.enter.stroke.value = '#7bccc4'
vis.display()
In [5]:
state_topo = r'us_states.topo.json'
geo_data = [
{'name': 'states',
'url': state_topo,
'feature': 'us_states.geo'}]
vis = vincent.Map(geo_data=geo_data, scale=1000, projection='albersUsa')
#del vis.marks[1].properties.update
vis.marks[0].properties.update.fill.value = '#6600CC'
#vis.marks[1].properties.enter.stroke.value = '#fff'
vis.marks[0].properties.enter.stroke.value = '#7bccc4'
vis.display()
In [6]:
zip_topo = r'zips_us_topo.json'
geo_data = [
{'name': 'states',
'url': zip_topo,
'feature': 'zip_codes_for_the_usa'}]
vis = vincent.Map(geo_data=geo_data, scale=1000, projection='albersUsa')
#del vis.marks[1].properties.update
#vis.marks[0].properties.update.fill.value = '#6600CC'
#vis.marks[1].properties.enter.stroke.value = '#fff'
#vis.marks[0].properties.enter.stroke.value = '#7bccc4'
vis.display()
In [4]:
zip_topo = r'zips_us_topo.json'
state_topo = r'us_states.topo.json'
geo_data = [{'name': 'zip_codes',
'url': zip_topo,
'feature': 'zip_codes_for_the_usa'},
{'name': 'states',
'url': state_topo,
'feature': 'us_states.geo'}]
vis = vincent.Map(geo_data=geo_data, scale=800, projection='albersUsa')
del vis.marks[1].properties.update
vis.marks[0].properties.update.fill.value = '#FFFFFF'
vis.marks[1].properties.enter.stroke.value = '#FF0000'
vis.marks[0].properties.enter.stroke.value = '#CCCCFF'
vis.display()
vis.to_json("USA_zip.json")
In [ ]: