I’m attempting to change the x axis of my graph in plotly to represent date while still having a trendline. I’ve created a plot where the x axis is date and y is another variable. In order to allow a trendline to be added the date has been converted to ordinal format using
df_final["ordinal_date"] = df_final['run_date'].map(dt.datetime.toordinal), but now its difficult to see what each of the points represents.
So I’m asking if there is a way to convert the x axis inplace back to datetime once the plot is made or if there is an alternative method to allow trendlines to be plotted where the x axis is date.
This is the code for the plot:
fig = px.scatter(df_filtered, x = "run_date", y = "Average q30", trendline= "ols" )