✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

Plotly Express - Line Charts are not shown

I would like to plot several line chart from different files. It works ok, but when the number of the graphs is bigger than 8 then the only last 8 line charts are shown (in the left up corner is shown a sad smiley in Jupyter Notebook).

df = pd.read_csv(‘G:\test.csv’)

df_long=pd.melt(df , id_vars=[‘ID’])

fig = px.line(df_long, y=‘value’, color=‘variable’)


Is there any way, how to disable this restriction?

So what’s happening here is actually kind of subtle… If your graphs contain more than a few thousand points, Plotly Express will switch to using WebGL to render your graphs, for increased performance. Unfortunately, each graph uses one “WebGL context” and browsers only permit some number of contexts per tab. The only recommendation I could make if you need more than 8 graphs in a tab is to force render_mode="SVG" in the px.line() call but be aware that interaction performance will degrade if you have more than a few thousand points in your graph.

Thank you very much. It works perfectly!