CodePudding user response:
You can update the range of x axis by:
fig = px.line(pmt_old_and_new, x="day", y="value", color="type")
fig.update_xaxes(range=[0, 12], row=1, col=1)
fig.show()
CodePudding user response:
define the range of the axis:
import numpy as np
import pandas as pd
import plotly.express as px
df = pd.concat([pd.DataFrame({"day":range(50),"avg_spending":np.random.randint(1,17,50)}).assign(type=type) for type in ["one","two"]])
fig = px.line(df, x="day", y="avg_spending", color="type")
fig.update_layout(yaxis={"dtick":1,"range":[0,17]},margin={"t":0,"b":0},height=500)