Zoom and panning in logarithmic plot offsets fixed line

I experience strange behavior when I zoom and pan in a simple logarithmic scatter plot: a fixed line drawn from (0,0) to (100,100) “jumps” to a wrong position when I first zoom and then pan.

Test code:

import math
import pandas as pd
import plotly.express as px

df = pd.DataFrame([
        [30, 30], 
        [70.0, 70.0]
    columns=['length', 'width'])

fig = px.scatter(df,

fig.update_xaxes(range=[0, math.log10(100*1.1)])
fig.update_yaxes(range=[0, math.log10(100*1.1)])
fig.add_shape(type="line", x0=0.0, y0=0.0, x1=100, y1=100)

Running this code, I get the following results:

  1. Image after startup:

  2. Zooming

  3. Image after zooming

  4. Image after panning

This seems lika a bug to me, or am I doing something wrong?

Dag Magne