Hello.
I have a time series graph where month/year dates along the X axis and sales/predicted sales along the Y axis. I’m noticing the points are offset from their actual dates. See below.
This is the code used to produce the above graph:
fig = go.Figure()
fig = make_subplots(rows=2, cols=1,shared_xaxes=True,subplot_titles=(item+" Predictions by Home Delivery", item+" Predictions by Shop Sales"))
for name, color in zip(names, colors):
fig.add_traces(go.Scatter(x=df_[(df_['model']==name) & (df_['location_type'] =='home_delivery')]['dmand_yr_mo'],
y = df_[(df_['model']==name) & (df_['location_type'] =='home_delivery')]['predicted_sales'],
# hovertemplate="%{x|%m/%Y} value: %{y}",
xperiod="M1",
name=name, marker_color=color,
showlegend=True,
legendgroup=name,
mode='markers'),
rows=1, cols=1)
fig.add_traces(go.Scatter(x=df_[(df_['model']==name) & (df_['location_type'] =='home_delivery')]['dmand_yr_mo'],
y = df_[(df_['model']==name) & (df_['location_type'] =='home_delivery')]['sales_dollars'],
# hovertemplate="%{x|%m/%Y} value: %{y}",
xperiod="M1",
name='actual_sales', marker_color='purple',
showlegend=False,
mode='lines'),
rows=1, cols=1,
)
fig.add_traces(go.Scatter(x=df_[(df_['model']==name) & (df_['location_type'] =='shop_sales')]['dmand_yr_mo'],
y = df_[(df_['model']==name) & (df_['location_type'] =='shop_sales')]['predicted_sales'],
# hovertemplate="%{x|%m/%Y} value: %{y}",
xperiod="M1",
How can I get the points to align with the dates correctly?