plotly express shows mid of the day marks that are not in the dataframe, how to fix?
how not to show mid of the 12pm on the chard. I want days only. Here is the dataset from the chart https://easyupload.io/gxfiq1
df_combined = df_combined.sort_values(by='s开发者_开发百科old_date', ascending=True)
df_smt = df_combined.loc[df_combined['model'] == 'Adapt'].groupby('date').agg({'price': 'sum', 'sold_date': 'count'}).reset_index()
fig = px.line(df_smt, x='date', y='price', title='Adapt')
fig.show()
Looks like you are trying to update the "x-tick" labels. The plotly documentation has some information on how to do this (https://plotly.com/python/tick-formatting/)
Something like
fig.update_layout(
xaxis_tickformat = '%b %d %Y',
)
should format the x-ticks as month (%b
), day (%d
), year (%Y
).
You can see more information on formatting options here (https://github.com/d3/d3-time-format/blob/main/README.md)
精彩评论