I'm looking for a way to draw two horizontal lines in a Plotly Scatter plot. My x-axis index is not fixed and keep changing everytime. So I'm looking for a Horizontal line at y = 5 and y = 18 passing horizontally across the chart
I looked here for a solution but I'm not sure how to use layouts with Plotly express
My code for scatter plot:
import plotly.express as px
df = pd.DataFrame({"x":[0, 1, 2, 3, 4,6,8,10,12,15,18], "y":[0, 1, 4, 9, 16,13,14,18,19,5,12]})
fig = px.scatter(df, x="x", y="y")
fig