Hello my Plotly Peeps!
Iโm combining a plotly express scatter and line chart in a dash app. When I combine them, my title goes away. Below is the code Iโm using in the call back.
def time_series_show_ss(item, snapshot):
df_ = df_final[(df_final['ord_base7']==item) & (df_final['snapshot'] == snapshot) & (df_final['location_type'] != "home_delivery")].sort_values('dmand_yr_mo').copy()
# print("Data for time series", df_[['dmand_yr_mo', 'ord_base7', 'snapshot', 'model', 'location_type', 'sales_dollars']].sort_values('dmand_yr_mo'))
fig = px.scatter(df_, x = 'dmand_yr_mo', y = 'predicted_sales', color = 'model',
title = "Sales vs. Actual")
fig1 = px.line(df_[(df_['model'] == 'base_model') & (df_['location_type'] != 'home_delivery')], x = 'dmand_yr_mo', y = 'sales_dollars')
fig3 = go.Figure(data=fig.data + fig1.data)
fig3.update_layout(hovermode="x unified")
return fig3
When I try to move the title under fig3
, i get an error message that states:
fig3 = go.Figure(data=fig.data + fig1.data, title="Time Series Look - Predicted (Markers) vs. Actual (Lines) Sales @ Shop Sales",)
File "/app/.heroku/python/lib/python3.7/site-packages/plotly/graph_objs/_figure.py", line 629, in __init__
super(Figure, self).__init__(data, layout, frames, skip_invalid, **kwargs)
File "/app/.heroku/python/lib/python3.7/site-packages/plotly/basedatatypes.py", line 647, in __init__
raise type_err
TypeError: invalid Figure property: title
title
Bad property path:
title
^^^^^
Does anyone know of a way to get my title back?