Four charts instead of one

I am using this example to practice within the jupyter lab, but I am generating four charts at the same time, one new one for each add_trace and another one for fig.show(), with the following result, is this the case for everyone? I’ve upgraded plotly to the latest version but it still doesn’t solve the problem. What can I do to fix it?

> np.random.seed(1)
> 
> N = 100
> random_x = np.linspace(0, 1, N)
> random_y0 = np.random.randn(N) + 5
> random_y1 = np.random.randn(N)
> random_y2 = np.random.randn(N) - 5
> 
> # Create traces
> fig = go.Figure()
> fig.add_trace(go.Scatter(x=random_x, y=random_y0,
>                     mode='lines',
>                     name='lines'))
> fig.add_trace(go.Scatter(x=random_x, y=random_y1,
>                     mode='lines+markers',
>                     name='lines+markers'))
> fig.add_trace(go.Scatter(x=random_x, y=random_y2,
>                     mode='markers', name='markers'))
> 
> fig.show()

Hi @chenhuan
Welcome to the community. I used your code on PyCharm and I only got one graph:

import numpy as np
import plotly.graph_objects as go
np.random.seed(1)

N = 100
random_x = np.linspace(0, 1, N)
random_y0 = np.random.randn(N) + 5
random_y1 = np.random.randn(N)
random_y2 = np.random.randn(N) - 5

# Create traces
fig = go.Figure()
fig.add_trace(go.Scatter(x=random_x, y=random_y0,
                     mode='lines',
                   name='lines'))
fig.add_trace(go.Scatter(x=random_x, y=random_y1,
                    mode='lines+markers',
                    name='lines+markers'))
fig.add_trace(go.Scatter(x=random_x, y=random_y2,
                     mode='markers', name='markers'))

fig.show()