i want 2016-2017data not show.
so i did below
df[‘Year’]=df.index.year
filtered_df = df[~df[‘Year’].isin([2016, 2017])]
filtered_df[‘Year’][filtered_df[‘Year’]== 2016]
fig = px.histogram(filtered_df, x=‘Year’, color=“규모별”,
barmode=‘stack’,
)
fig.update_layout(width=800, height=600)
fig.show()
but there is a hole. i want there are no hole
can you help me???
AIMPED
2
That is because you are using a time x-axis. Try changing to category.
See also here:
Thank you. I fixed it with go.
but i have question about xaxis in px.
in px.histogram, i can’t fix this.
https://plotly.github.io/plotly.py-docs/generated/plotly.express.histogram.html
i can’t find xaxis categorical…
in px.histogram, can i fix it??
AIMPED
4
This should work:
fig.update_xaxes({'type': 'category'})
px uses go under the hood.