When I do:
fig = px.line(df, x="day", y="avg_spending")
fig.show()
It doesn't put values in y axis by 2 (0, 2, 4,...). I want it to be 1 by 1 (0,1,2,3,..). My maximum value of "avg_spending" in df is 17, so I would like there to be 1,2,3,...,17 on y axis. How to do that?
set the dtick parameter on the axis
import numpy as np
import pandas as pd
import plotly.express as px
df = pd.DataFrame({"day":range(50),"avg_spending":np.random.randint(1,17,50)})
fig = px.line(df, x="day", y="avg_spending")
fig.update_layout(yaxis={"dtick":1},margin={"t":0,"b":0},height=500)