I am trying to add a rectangle shape onto a plotly scattergl() and have it retain its position and size when resizing the screen i.e. moving the plot from one monitor to a small monitor. The graph text seems to handle this fine but the shapes are resizing. I have tried all of the xref and yref args to no avail. The code I have used for the rectangle is:
fig.add_shape(type="rect", xref='x', yref='y', x0=-115-5, x1=-128-6, y0=12.5, y1=47.5, fillcolor='red', opacity=0.33, ) fig.add_shape(type="rect", x0=-115-5, x1=-128-6, y0=12.5, y1=47.5, line=dict( color="slategrey", width=2), )
The current issue is shown in the two screenshots below. The 1st is a screenshot of the rectangle in full screen mode and the second is when I just shrink the window. Ideally I want the rectangle to stay aligned with the text.