My plotly express graph is showing partial years on the x-axis

25 Views Asked by At
hail_month2 = {"YEAR": [2018, 2019], "MAGNITUDE": [1.75, 2]}
hail_month2 = pd.DataFrame(hail_month2)
month2 = px.histogram(hail_month2, 
                           x=hail_month2.YEAR,
                           color=hail_month2.MAGNITUDE)
month2

Graph

How can I make the xaxis only show the years instead of half years like 2019.5?

1

There are 1 best solutions below

0
Shawn On

Solved by @r-beginners:

month2.update_xaxes(type='category');month2.show()

Fixed Graph