我正在尝试按熊猫数据框中列所确定的类别对地图上的点进行分组。以下代码使用plotly和Dash框架构建地图布局和绘图坐标。
for i, row in Comp_data.groupby('Group'):
data.append({
"type": "scattermapbox",
"lat": [hlat],
"lon": [hlong],
"name": "Location",
"mode": "markers",
"marker": {
"symbol": "circle",
"color": "grey", <-- needs to be dynamic based on the group
"size": 6,
"opacity": 0.7
}
}
)
有什么想法/建议吗?
答案 0 :(得分:0)
尝试忽略color
属性。该图将为每个数据集提供另一种颜色。
"marker": {
"symbol": "circle",
"size": 6,
"opacity": 0.7
}