You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Only the last 8 line graphs are displayed in vscode notebook editor #3440
When rendering more than 8 line graphs in vscode notebook editor a very strange thing happens.
As long as the number of graphs remain under 8 they are all displayed properly. As additional graphs are added the first ones loose their content so that only the last 8 are properly displayed. The graphs that loose their content don't just disappear, they still display the background, grid, legend, and even when hovering with the mouse over the empty graph the popup label is displayed properly, only the lines are missing. The attached screenshot shows such a graph that lost its content.
Reproducing:
import plotly.express as px
df = px.data.gapminder()
for i in range(0,10):
fig = px.line(df, x="year", y=["lifeExp", "gdpPercap"], title='Life expectancy in Canada')
fig.show()
Version info:
vscode: latest (1.61.2)
python: 3.6.8
plotly: latest (5.3.1)
Additional info:
This only happens with "complex" graphs. If you remove one of the fields from the y axis in the above example it won't happen any more.
It doesn't seem to happen with other types of graphs, at least not with bar charts.
I didn't test this directly in Jupyter so don't know if the issue happens there as well.
Explicitly setting plotly.io.renderers.default = "vscode" doesn't help
This is unfortunately a hard limitation of browsers rendering WebGL plots... See documentation here re "context limits": https://plotly.com/python/webgl-vs-svg/
I see, thank you. Setting render_mode='svg' indeed solves the issue.
That said, it seems that the current behavior doesn't make a lot of sense. I'd argue that most people would rather the graphs are displayed, even if a bit slower, rather than disappearing altogether with no explanation. Would it be possible to keep a global counter of the number of webgl rendered graphs and automatically switch back to SVG mode when going above 8? At least when running in a Notebook that shouldn't be a problem.
Hi - we are trying to tidy up the stale issues and PRs in Plotly's public repositories so that we can focus on things that are still important to our community. Since this one has been sitting for several years, I'm going to close it; if it is still a concern, please add a comment letting us know what recent version of our software you've checked it with so that I can reopen it and add it to our backlog. Thanks for your help - @gvwilson
Activity
nicolaskruchten commentedon Oct 25, 2021
This is unfortunately a hard limitation of browsers rendering WebGL plots... See documentation here re "context limits": https://plotly.com/python/webgl-vs-svg/
ekutner commentedon Oct 25, 2021
I see, thank you. Setting render_mode='svg' indeed solves the issue.
That said, it seems that the current behavior doesn't make a lot of sense. I'd argue that most people would rather the graphs are displayed, even if a bit slower, rather than disappearing altogether with no explanation. Would it be possible to keep a global counter of the number of webgl rendered graphs and automatically switch back to SVG mode when going above 8? At least when running in a Notebook that shouldn't be a problem.
gvwilson commentedon Jul 3, 2024
Hi - we are trying to tidy up the stale issues and PRs in Plotly's public repositories so that we can focus on things that are still important to our community. Since this one has been sitting for several years, I'm going to close it; if it is still a concern, please add a comment letting us know what recent version of our software you've checked it with so that I can reopen it and add it to our backlog. Thanks for your help - @gvwilson