Announcing Dash Bio 1.0.0 🎉 : a one-stop-shop for bioinformatics and drug development visualizations.

Add arrow in 'paper' area is returning error

Hi everybody.

I am trying to draw an arrow below the x_axis with the following code:

       myplot = go.Figure(data=go.Scatter(x=df['time'], y=df['count'], mode='markers'))
        

        xstart = -2
        xmax = 3.5
        xmin = -3.5
        padding = 0.05
        ypos = -0.1


        mylplot.update_layout(
            plot_bgcolor=colors['backgraph'],
            paper_bgcolor=colors['backpaper'],
            font_color=colors['text'],
            showlegend=False,
            width=550,
            height=550,
            xaxis=dict(title_text="Time", showgrid=False, showticklabels=False),
            yaxis=dict(title_text="Counts", showgrid=False, showticklabels=False),
            
            annotations=[dict(
                x=xmin,
                y=ypos,
                ax=xstart + padding,
                ay=ypos,
                xref='x',
                axref='x',
                yref='paper',
                ayref='paper',
                showarrow=True,
                arrowhead=2,
                arrowsize=1,
                arrowwidth=3,
                arrowcolor='#0000ff', 
            )],

but I am receiving the following error:

ValueError: 
    Invalid value of type 'builtins.str' received for the 'ayref' property of layout.annotation
        Received value: 'paper'

    The 'ayref' property is an enumeration that may be specified as:
      - One of the following enumeration values:
            ['pixel']
      - A string that matches one of the following regular expressions:
            ['^y([2-9]|[1-9][0-9]+)?$']```

If if pass y value to ayref, the arrow is not shown. Help is appreaciated.

Hi @iops, indeed the value of ayref has to be y (or y2, y3), as explained in the documentation. Here is an example adapted from the documentation on annotations plotting an arrow below the xaxis

import plotly.graph_objects as go

fig = go.Figure()

fig.add_trace(go.Scatter(
    x=[0, 1, 2, 3, 4, 5, 6, 7, 8],
    y=[0, 1, 3, 2, 4, 3, 4, 6, 5]
))

fig.update_layout(
    showlegend=False,
    annotations=[
        dict(
            x=8,
            y=-0.1,
            xref="x",
            yref="paper",
            showarrow=True,
            arrowhead=5,
            ax=0,
            ay=0,
            axref='x',
            ayref='y'
        )
    ]
)

fig.show()