【发布时间】:2020-09-16 15:42:50
【问题描述】:
我正在关注如何使用点击事件更新散点图中的点的示例 https://plotly.com/python/click-events/.
示例中的回调函数在单击时更新标记的颜色和大小。 (代码提取后见我的问题)
# create our callback function
def update_point(trace, points, selector):
id=trace.ids[points.point_inds[0]]
c = list(scatter.marker.color)
s = list(scatter.marker.size)
for i in points.point_inds:
#change only this one
c[i] = '#bae2be'
s[i] = 20
with f.batch_update():
scatter.marker.color = c
scatter.marker.size = s
我的问题是:如何在同一次点击中更新标记文本(在本例中为 Scatter 对象的文本参数)?
谢谢
迈克尔
【问题讨论】: