# How to draw arrow that has legend?

Hi

How can I draw arrows using plotly.Python and assign legend for them? I used annotations but I can’t assign them legend because it doesn’t have this property.

@empet hi

Can we use your comment [go.Scatter() plot with oriented markers (for example tadpole markers) - #2 by empet] to draw arrows (By combining lines and markers) for this page question? (I doubt about incline directions)

@Bijan
No, we can’t!

1 Like

@Bijan
Have you tried to plot arrows with ff.create_quiver()?

``````fig = ff.create_quiver(x=[0.5, 0.7], y=[1, 0.8], u=[1.2, 1.35], v=[0.9, -0.7],
scale=0.055,
arrow_scale=0.38,
angle=9*np.pi/180,
scaleratio=1,
line=dict(width=1.25, color='RoyalBlue'))

fig.update_traces(fill="toself", name="arrow",  showlegend=True)
fig.update_layout(width=500, height=400)
``````

This line

``````fig.update_traces(fill="toself", name="arrow",  showlegend=True)'
``````

fills the arrow, assigns a name to your arrows, to be displayed in legend.

For more details on the arguments of the function `ff.create_quiver()`
`print(help(ff.create_quiver))`

2 Likes

@empet

Thanks Dear, This is exactly what I needed. You are grand dude