Vincent Python Map with Text Labels

219 views Asked by At

I would like to display a map of US DMAs (geographical area similar to county/state, based on advertising considerations) with some data binding for the color (which I managed to do) AND labels for the DMA number (each DMA has a 3 digit code associated with it).

My Code is as follows so far

import pandas as pd
import matplotlib.pyplot as plt
import vincent as vi

vi.core.initialize_notebook()

df = pd.read_csv('data.csv', sep=',')

geo_data = [{'name': 'dma',
         'url': r'https://raw.githubusercontent.com/simzou/nielsen-dma/master/nielsentopo.json',
         'feature': "nielsen_dma"}
]

vis = vi.Map(data = df, geo_data=geo_data, projection='albersUsa',
      data_bind='numberDMA', 
      data_key='dma',
      map_key={'dma': 'properties.dma'}) 

vis.to_json('vega.json', html_out=True, html_path=map.html')
0

There are 0 answers