I would like to add arrows to plotly figure. I looked at this question Draw multiple arrows using plotly python but I do not understand how to apply that. I tried this:
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import plotly.express as px
import plotly.graph_objects as go
d = {'a': [1, 2, 2], 'b': [3, 5, 4], 'c': [0.1, 0.2, 0.6]}
df = pd.DataFrame(data=d)
fig = px.scatter(df, x='a', y='b', error_y='c')
fig.update_xaxes(title_font_family="Trebuchet")
layout = go.Layout(
yaxis=dict(scaleanchor="x", scaleratio=1),
template = "plotly_white",
title="<b>V</b>",
)
fig.layout = layout
fig.update_layout(
xaxis = dict(autorange="reversed")
)
##################
arrow = go.layout.Annotation(dict(
x= x_end,
y= y_end,
xref="x", yref="y",
text="",
showarrow=True,
axref = "x", ayref='y',
ax= x_start,
ay= y_start,
arrowhead = 3,
arrowwidth=1.5,
arrowcolor='rgb(255,51,0)',)
)
x_end = [1, 2, 4]
y_end = [6, 5, 6]
fig.update_layout(
annotations= dict(x_end, y_end,))
###################
fig.write_html("Fig.html")
fig.show()
The part in #### is not working. I would like to add arrows from the points in the scatter to the points with coordinates in x_end and y_end.
Thank you so much