1

I have made a Plotly Express line graph:

fig = px.line(pmt_old_and_new, x="day", y="value", color="type")


fig.show()

However it doesn't have 0 as starting point on graph. How to add it? I want axis to have 0

enter image description here

french_fries
  • 1,149
  • 6
  • 22

1 Answers1

0

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)


Rob Raymond
  • 29,118
  • 3
  • 14
  • 30