I am using the plotly.graph_objects.Figure.add_annotation()
function to add an arrow into my plot - see a simple example code below:
import plotly.graph_objects as go
fig = go.Figure()
fig.add_annotation(ax = 3, axref = 'x', ay = 2, ayref = 'y',
x = 4, xref = 'x', y = 2, yref = 'y',
arrowhead = 3)
fig.add_shape(x0 = 1, x1 = 3, xref = 'x',
y0 = 1, y1 = 3, yref = 'y')
fig.add_shape(x0 = 4, x1 = 6, xref = 'x',
y0 = 1, y1 = 3, yref = 'y')
fig.update_layout(xaxis_range = [0, 7], yaxis_range = [0, 4])
fig.show()
which renders the following image:
As you can see, there is a small gap between the left rectangle and the tail of the arrow. Is there a way to remove this gap, so that the arrow starts exactly as specified by the parameters ax
and ay
? I have tried looking through the documentation to see if there may be other relevant parameters of the add_annotation()
function but couldn’t find clues. Thanks!