Issue with callback graph

I have a graph array. I would like to overlap the graphs then display it to give the appears of one graph. When I saved boths graphs as 1, my callback gave me an error. Can you please tell me the best way to accomplish this? Also in this scenario, which graph should be defined in my callback output, the finally displayed graph or all 3: fig[0], fig[1] and the display graph

please help! thanks

Code:

from plotly.colors import qualitative
from plotly.subplots import make_subplots
COLORS = qualitative.T10

def create_figures(title, n=3):
figs =
annot_props = {“x”: 0.1, “xref”: “paper”, “yref”: “paper”, “xanchor”: “left”,
“showarrow”: False, “font”: {“size”: 18},}
for _ in range(n):
fig = make_subplots(rows=2, cols=1, vertical_spacing=0.1)
fig.update_layout(
title={“text”: title, “x”: 0.5, “y”: 0.97, “font”: {“size”: 20}},
annotations=[
{“y”: 0.95, “text”: “All”},
{“y”: 0.3, “text”: “” + title+ “”},
],
margin={“t”: 40, “l”: 50, “r”: 10, “b”: 0},
legend={“x”: 0.5, “y”: -0.05, “xanchor”: “center”, “orientation”: “h”,
“font”: {“size”: 15}})
fig.update_traces(showlegend=False, row=2, col=1)
fig.update_traces(hovertemplate=“%{x} - %{y:,}”)
fig.update_annotations(annot_props)
figs.append(fig)

return figs

def make_cumulative_graphs(fig, type_value):

# top subplot
fig.add_scatter(x=my_data.cu_purchase_dt, 
                        y=my_data['y_pred'], 
                        mode="markers",
                        line={'color':COLORS[1]},
                        name='prediction',                 
                        row=1,
                        col=1) 
fig.add_scatter(x=my_data.cu_purchase_dt, 
                        y=my_data['types'], 
                        mode="markers", 
                        line={'color':COLORS[0]},
                        name='actual',
                        row=1,
                        col=1) 

def make_type_graphs(fig, target_df,type_label_value, type_value):

print(type_value)

for y_pred,cu_cancel_dt in target_df.groupby('types'):
    fig.add_scatter(y=target_df.y_pred, x=target_df.cu_cancel_dt, 
                            #y=target_df['types'], 
                        mode="markers", 
                        line={'color':COLORS[1]},
                        name='prediction',text=target_df.type_label ,
                        row=2,
                        col=1) 
for types,cu_cancel_dt in target_df.groupby('types'):
    fig.add_scatter(y=target_df.types, x=target_df.cu_cancel_dt, 
                            #y=target_df['types'], 
                        mode="markers",  
                        line={'color':COLORS[0]},
                        name='actual',text=target_df.type_label ,
                        row=2,
                        col=1) 
fig.update_xaxes( categoryorder='array')  

value_title = "<b>"  + type_label_value +  "</b>"

fig.update_layout(          
            
            
                annotations=[
                {"y": 0.95, "text": "<b>All Types</b>"},
                {"y": 0.3, "text": value_title}],
            
       
        margin={"t": 40, "l": 50, "r": 10, "b": 0},
        legend={
            "x": 0.5, 
            "y": -0.05, 
            "xanchor": "center", 
            "orientation": "h", 
            "font": {"size": 15}},
    )
annot_props = {
    "x": 0.1,
    "xref": "paper",
    "yref": "paper",
    "xanchor": "left",
    "showarrow": False,
    "font": {"size": 18},
}
fig.update_annotations(annot_props)

def new_create_subplots(type_value):

if type_value == 0:
    target_df = Loyalist_df
    type_label_value = "Loyalist"
elif type_value == 1:
    target_df = High_Maintenance_df
    type_label_value = "High Maintenance"
elif type_value == 2:
    target_df = Potential_Loyalist_df
    type_label_value = "Potential Loyalist"
elif type_value == 3:
    target_df = Satisfied_df
    type_label_value = "Satisfied"
elif type_value == 4:
    target_df = dissatisfied_df
    type_label_value = "Dissatisfied"
else: target_df = pd.DataFrame()    
   
print(type_label_value)
print(type_value)
#call graphs seperately
figs = create_figures(type_label_value)
make_cumulative_graphs(figs[0], type_value)
make_type_graphs(figs[1],target_df,type_label_value,  type_value)

return figs

Instead of creating two graphs, you should create one graph with two traces.