Why there are two figures

Hi, I use jupyterlab to run these code:

import plotly.express as px

df = px.data.gapminder().query(ā€œcontinent == ā€˜Europeā€™ and year == 2007 and pop > 2.e6ā€)

fig = px.bar(df, y=ā€˜popā€™, x=ā€˜countryā€™, text_auto=ā€˜.2sā€™,
title=ā€œControlled text sizes, positions and anglesā€)

fig.update_traces(textfont_size=12, textangle=0, textposition=ā€œoutsideā€, cliponaxis=False)

fig.show()

But it comes out two figuresā€¦Could someone hlep meā€¦Thanks!

This doesnā€™t happen for me when I run it in Jupyterlab - it all looks fine, only one graph displayed

(Python 3.11.2, plotly 5.20.0)

I finally know whatā€™s happeningā€¦
Itā€™s all because:

~/.ipython/profile_default/ipython_config.py file,the file content:

c = get_config()

Run all nodes interactively

c.InteractiveShell.ast_node_interactivity = ā€œallā€

If your ipython_config.py file donā€™t have these two sentences(c = get_config() c.InteractiveShell.ast_node_interactivity = ā€œallā€), you get one figure