Horizontal line moves outside the plot

Below is the code for testing.

import streamlit as st
import plotly.graph_objects as go
from plotly.subplots import make_subplots
import numpy as np

fig = make_subplots(rows=3,cols=4,column_titles=["plot1","plot2","plot3","plot4","plot5","plot6","plot7","plot8","plot9","plot10","plot11","plot12"])

for i in range(1, 13):
    x = np.random.rand(10)
    y = np.random.rand(10)
    fig.add_trace(go.Scatter(x=x, y=y, mode='markers'), row=(i - 1) // 4 + 1, col=(i - 1) % 4 + 1)
    fig.add_hline(y=i, line=dict(color='red', width=2))

fig.update_layout(height=600, width=800, title_text="12 Subplots with Horizontal Lines")

st.plotly_chart(fig)

When you run the above code, a screen like the one below will be displayed in streamlit.

If you slide the x-axis in the second subplot from the left in the bottom row, the horizontal line will move to the outside of the plot as shown in the figure below.

Is there a way to fix it?