如何使用python bokeh构建动画计数器?

时间:2016-05-05 16:30:32

标签: python python-2.7 pandas data-visualization bokeh

我正在研究python bokeh,我想知道是否有可能使用散景构建一个动画计数器。我想要做的是从地图中的选定区域拉出男性的数量,并显示从0到特定区域中的男性数量的数字。请给我看一些例子,或者使用下面的地图给我看一个例子。

from bokeh.models import GeoJSONDataSource, HoverTool
from bokeh.plotting import figure, show
import pandas as pd 


with open('ug_population.geo.json','r') as f:
    geojson = f.read()

geo_source = GeoJSONDataSource(geojson=geojson)

def build_map():

    mp = figure(height=600, width=600,tools="tap", title="Click the District")
    mp.patches(xs='xs' , ys='ys',fill_color = "#EBE02A",fill_alpha=0.7, source=geo_source)
    mp.multi_line(xs='xs', ys='ys', line_color='white', line_width=0.1, source=geo_source)
    mp.add_tools(HoverTool(tooltips=[("District", "@name"),("Total Population","@total")]))

    return mp


mp = build_map()
show(mp)

任何帮助都将受到赞赏。使用的jsonfile可以在Pastebin of json file

找到

0 个答案:

没有答案
相关问题