Plotly Choropleth 未使用 ISO 代码显示颜色

问题描述

我希望绘制美国的计数(频率)和区域(使用区域 ISO 代码)的等值线图。我目前正在使用 plotly,但我似乎无法弄清楚为什么没有显示应该显示频率的颜色。 我没有 fibs 专栏,我只有 ISO。

谢谢..

from urllib.request import urlopen
import pandas as pd
import plotly.express as px
import json
from pyspark.sql.types import IntegerType



# with urlopen('https://raw.githubusercontent.com/plotly/datasets/master/geojson-counties-fips.json') as # response:
#     counties = json.load(response)

df = location_test.toPandas()

fig = px.choropleth_mapBox(df,locations=df['location_region_iso_code'],color=df['count'],color_continuous_scale="Viridis",range_color=(0,15),mapBox_style="carto-positron",zoom=3,center = {"lat": 37.0902,"lon": -95.7129},opacity=0.5,labels={'count':'Count'}
                          )
fig.update_layout(margin={"r":0,"t":0,"l":0,"b":0})
fig.show()

这是我得到的输出

Map showing regions and frequency

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)