Problem when switching from scatterplot to Splom

Hey,
I met a problem that when I change my plot type from scatterplot to Splom, there is one subset of the Splom still contains the scatters from scatterplot.

@app.callback(
    dash.dependencies.Output('my-scattergram', 'children'),
    [dash.dependencies.Input('x_variable', 'value'),
     dash.dependencies.Input('y_variable', 'value'),
     dash.dependencies.Input('confidence_ellipses', 'value'),
     dash.dependencies.Input('choices', 'value'),
     dash.dependencies.Input('pairwise', 'value')
     ])
def plot_graph(x_variable, y_variable, if_ellipses, choices, pairwise):
    global default
    if not pairwise:
        default['x_variable'] = x_variable
        default['y_variable'] = y_variable
        if not if_ellipses:
            default['confidence'] = '0'
        else:
            default['confidence'] = '1'
        x1=np.array(df[df['My_Group']==1][x_variable].values)
        y1=np.array(df[df['My_Group']==1][y_variable].values)
        x2=np.array(df[df['My_Group']==2][x_variable].values)
        y2=np.array(df[df['My_Group']==2][y_variable].values)
        fig = make_subplots(rows=1, cols=1)
        fig.append_trace(go.Scatter(
            x=x1,
            y=y1,
            mode='markers',
            marker=dict(color="rgb(0,0,205)"),
            name='Group 1',

        ),
            row=1, col=1)
        Min_x = min(min(x1),min(x2))
        Min_y = min(min(y1),min(y2))
        Max_x = max(max(x1),max(x2))
        Max_y = max(max(y1),max(y2))
        offset_x = 0.1 * Max_x
        range_x_min = Min_x - offset_x
        range_x_max = Max_x + offset_x
        offset_y = 0.1 * Max_y
        range_y_min = Min_y - offset_y
        range_y_max = Max_y + offset_y
        fig.layout.xaxis={'visible':True,'title':{'text':x_variable},'range':[range_x_min, range_x_max]}
        fig.layout.yaxis={'title':{'text':y_variable},'range':[range_y_min, range_y_max]}
        fig.append_trace(go.Scatter(
            x=x2,
            y=y2,
            mode='markers',
            marker=dict(color="rgb(255,48,48)"),
            name='Group 2'
        ), row=1, col=1)
        if if_ellipses==['1']:
            group1 = dataEllipse(x1, y1)
            group2 = dataEllipse(x2, y2)
            if (group1 is not None) and (group2 is not None):
                fig.append_trace(go.Scatter(
                    x=group1[:,0],
                    y=group1[:,1],
                    mode='lines',
                    line=dict(color='rgb(0,0,205)'),
                    showlegend=False
                ), row=1, col=1)
                fig.append_trace(go.Scatter(
                    x=group2[:,0],

                    y=group2[:,1],
                    mode='lines',
                    line=dict(color='rgb(255,48,48)'),
                    showlegend=False
                ), row=1, col=1)
            else:
                pass
    else:
        if len(choices) <= 1:
            return ''
        fig = go.Figure(data=go.Splom(
            dimensions=[
                dict(label=i, values=df[i]) for i in choices
            ]
        ))
    return dcc.Graph(figure=fig,
                     style={
                         'width':800,
                         'height':800,
                         'marginLeft':'7cm',
                         'display': 'inline-block'
                     })

Below are the screenshots of my result.


Solved by simply add one more children for scatter plot and pairwise scatter each.