我正在尝试使用 plotly.express 创建一个显示值是气泡(圆圈)的地图。
当前值的范围从 16000 到 21500。我已经启动并运行了所有内容,气泡以不同的颜色显示,但是,它们或多或少都具有相同的大小。
我想要的是用小气泡显示的最小值和用大气泡显示的最大值以及介于两者之间的其他值。
这是我的数据框的样子:
country average long lat
0 Baden-Württemberg 19166.381092 9.179330 48.781956
1 Bayern 18786.556728 11.572199 48.137859
2 Berlin 21463.044514 13.387224 52.533707
3 Brandenburg 19622.567766 13.070526 52.405476
4 Bremen 16197.013903 8.805129 53.081386
5 Hamburg 18426.436184 10.001104 53.554158
这就是我显示它的方式:
fig = px.scatter_mapbox(all_data, lat="lat", lon="long", hover_name="country", hover_data=["country", "average"],
color="average",
size="average", color_continuous_scale=px.colors.sequential.matter, size_max=20,
zoom=5, height=1000, mapbox_style="open-street-map")
fig.update_layout(margin={"r":0,"t":0,"l":0,"b":0})
fig.show()
这就是它的样子: 打开带有气泡的街道地图
如何影响气泡的大小,以使较小的值具有较小的直径,而较大的值具有较大的直径?
我尝试使用 size_max-value,但所有气泡仍然具有相同的大小,只是它们都更大或更小。