threshold_scale = np.linspace(df_value_counts['Count'].min(),
df_value_counts['Count'].max(),
6, dtype=int)
threshold_scale = threshold_scale.tolist()
threshold_scale[-1] = threshold_scale[-1] + 1
sf_map.choropleth(
geo_data=sf_geo,
data=df_value_counts,
columns=['Neighborhood', 'Count'],
key_on='feature.properties.name',
fill_color='YlOrRd',
fill_opacity=0.7,
line_opacity=0.2,
threshold_scale=threshold_scale,
legend_name='Crime Rate in San Francisco')
sf_map
问题在
key_on='feature.properties.name'
应该是
key_on='feature.properties.DISTRICT'
查看JSON文件,查看lat/long坐标映射到哪里。 在world map示例中,在JSON文件中它是'name',但是在san fransico它是'discritt'
^{pr2}$sf_geo = r'san_francisco_nh.json'
san fransico choropleth map
相关问题 更多 >
编程相关推荐