dfdf
April 17, 2024, 6:25am
1
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)
dfdf
April 17, 2024, 7:14am
3
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