[英]Marker over plotly dots in a scatterplot
這是一個可能合適的示例。 可以從此頁面選擇標記。 開放式標記看起來很有趣,因為它可以包含一個較小的標記。 但是您也可以向 x 和 y 添加一個小的偏移量以定位任何標記。
import random
import plotly.graph_objects as go
N = 20
x1 = [random.gauss(2, .5) for _ in range(N)]
y1 = [random.gauss(2, .5) for _ in range(N)]
x2 = [random.gauss(4, .4) for _ in range(N)]
y2 = [random.gauss(2, .2) for _ in range(N)]
x3 = [random.gauss(3, .4) for _ in range(N)]
y3 = [random.gauss(4, .3) for _ in range(N)]
# x,y for rightmost dot
max_xy = [max(zip(x1,y1)), max(zip(x2,y2)), max(zip(x3,y3))]
max_x = [m[0] for m in max_xy]
max_y = [m[1] for m in max_xy]
fig = go.Figure()
fig.add_trace(go.Scatter(
x = x1+x2+x3,
y = y1+y2+y3,
mode='markers',
marker=dict(
size=15,
color=[.3] * N + [.65] * N + [.8] * N,
colorscale='jet'
)
))
fig.add_trace(go.Scatter(
x = max_x,
y = max_y,
mode='markers',
marker=dict(
size=30,
line=dict(width=3, color='pink'),
symbol=[117, 118, 114]
)
))
fig.update_layout(showlegend=False)
fig.show()
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.