Hi.
I’m trying to create a scatter plot with arrows joining the markers. I’m having trouble positioning the tail of the arrow at the edge of the marker. Here is the code I have thus far:
import plotly.plotly as py
import plotly.graph_objs as go
trace1 = go.Scatter(
x=[5, 1, 2, 4],
y=[9, 15, 8, 11],
text=['...'],
mode='markers',
name = '2016',
marker=dict(size=[125, 50, 110, 75]))
trace2 = go.Scatter(
x=[3, 1, 3, 2],
y=[4, 12, 19, 10],
text=['...'],
mode='markers',
name = '2017',
marker=dict(size=[80, 40, 150, 120]))
layout = go.Layout(
showlegend=True,
annotations=[
dict(
ax=5,
ay=9,
axref='x',
ayref='y',
showarrow=True,
arrowhead=2,
arrowsize=1,
arrowwidth=2,
arrowcolor='#636363',
x=3,
y=4,
xref='x',
yref='y',
standoff = 80/2
),
dict(
ax=1,
ay=15,
xref='x',
yref='y',
showarrow=True,
arrowhead=2,
arrowsize=1,
arrowwidth=2,
arrowcolor='#636363',
axref='x',
ayref='y',
standoff = 40/2,
x=1,
y=12
),
dict(
ax=2,
ay=8,
xref='x',
yref='y',
showarrow=True,
arrowhead=2,
arrowsize=1,
arrowwidth=2,
arrowcolor='#636363',
axref='x',
ayref='y',
standoff = 150/2,
x=3,
y=19
),
dict(
ax=4,
ay=11,
xref='x',
yref='y',
showarrow=True,
arrowhead=2,
arrowsize=1,
arrowwidth=2,
arrowcolor='#636363',
axref='x',
ayref='y',
standoff = 120/2,
x=2,
y=10
)
])
data = [trace1, trace2]
fig = go.Figure(data=data, layout=layout)
py.iplot(fig, filename='bubblechart-arrow')
Thanks ahead