dictionary - Plotly Express 或 Go - map 县内的标签

标签 dictionary label plotly

我正在尝试基于“CHANGE”或“COUNTY”项目在图 block 上放置标签,如下所示。我无法实现它。下面是我的示例代码。

fig = px.choropleth(stat_data, geojson=geo_json_data, color="CHANGE",
                    locations="COUNTY", featureidkey="properties.COUNTY",
                    projection="mercator",
                    color_continuous_scale=px.colors.diverging.RdYlGn, color_continuous_midpoint=2
                          )

fig.update_geos(fitbounds="locations", visible=False)
fig.show()

我尝试使用plotlyexpress或go方法并使用answer on other forum上显示的建议看起来它只适用于图形工厂,因为分散方法仅适用于该工厂。

任何帮助将不胜感激。

enter image description here

最佳答案

我在这里找到了答案:https://community.plotly.com/t/annotations-on-plotly-choropleth/36219

fig.add_scattergeo(
  geojson=counties,
  locations = df['names'],
  text = df['values'],
  featureidkey="properties.NAME_3",
  mode = 'text') 

关于dictionary - Plotly Express 或 Go - map 县内的标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61177895/

相关文章:

c++ - 在 C++ 中使用指针作为映射的值

ios - 在 Swift (Xcode 6) 的其他 View 中使用来自 View 的输入文本

c# - 在 C# 中是否有相当于 Java 的标记中断或解决方法

R plotly : preserving appearance of TWO legends when converting ggplot2 with ggplotly

python - 将两个字典中的元素放入列表中

java - 如何将嵌套 yaml 结构映射到 Java ConfigurationProvider Builder?

python - 从字典列表中删除重复的字典

java - Swing GUI 在数据处理期间不会更新

r - 如何在绘图图上设置 X 轴范围?

python - 在 Python 中,如何使用 'update_annotations' 更新 plotly 数字?