Draw shape referenced to paper, but with length referenced to axis

Is it possible to draw shapes referenced to paper, but with size referenced to axis?

For example, consider this chart:

    import plotly.express as px
    import pandas as pd

    df = px.data.stocks()

    fig = px.line(df, x='date', y="GOOG")
                  y0=0.9, y1=0.9, yref='y domain')


In the resulting chart the line is always fixed at 90% the height of the paper. Its length is 183 days , but if I zoom horizontally, the line moves. This is clearly because I have passed two specific dates. What I would like to draw instead is a line which starts say at 10% the paper width, and is of length 183 days, so that whenever I zoom i can always see the line starting at (10%, 90%) the paper width and terminating at (10%paperwidth + 183days, 90% paper width).

Setting xref='x domain' does not help as it would result in a line of varying length (with respect to the x axis).

Is this even possible in plotly? If so, how?

Hi @lucamingarelli

I don’t think this is possible in plotly. I could imagine a l´solution in dash. You would have to grab the current axis range on zoom, do the calculations and create the annotation. More or less like in this topic, but you would use the zooming as input.