Enhancement: Use python installed plotly.min.js instead of renderer.
See original GitHub issueAdding fig.update_layout(legend_groupclick="toggleitem")
(as documented) to the grouped legend items example does not affect legend click behavior in VS Code. It does when opening the figure in a browser. This appears to be because VS Code Jupyter ships with an outdated version of plotly.js.
Posted earlier: plotly/plotly.py#3488 Related: #2648
import plotly.graph_objects as go
fig = go.Figure()
fig.add_trace(
go.Scatter(
x=[1, 2, 3],
y=[2, 1, 3],
legendgroup="group", # this can be any string, not just "group"
legendgrouptitle_text="First Group Title",
name="first legend group",
mode="markers",
marker=dict(color="Crimson", size=10),
)
)
fig.add_trace(
go.Scatter(
x=[1, 2, 3],
y=[2, 2, 2],
legendgroup="group",
name="first legend group - average",
mode="lines",
line=dict(color="Crimson"),
)
)
fig.add_trace(
go.Scatter(
x=[1, 2, 3],
y=[4, 9, 2],
legendgroup="group2",
legendgrouptitle_text="Second Group Title",
name="second legend group",
mode="markers",
marker=dict(color="MediumPurple", size=10),
)
)
fig.add_trace(
go.Scatter(
x=[1, 2, 3],
y=[5, 5, 5],
legendgroup="group2",
name="second legend group - average",
mode="lines",
line=dict(color="MediumPurple"),
)
)
# No effect from this line
fig.update_layout(legend_groupclick="toggleitem")
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:24 (17 by maintainers)
Top Results From Across the Web
Displaying figures in Python - Plotly
Interactive renderers display figures using the plotly.js JavaScript library and are fully interactive, supporting pan, zoom, hover tooltips, etc. notebook ¶.
Read more >Adding CSS & JS and Overriding the Page-Load Template
Learn how to add custom CSS and JS to your app as well as how to customize the HTML title, meta tags, and...
Read more >Getting started with plotly in Python
This Getting Started guide explains how to install plotly and related optional pages. Once you've installed, you can use our documentation in three...
Read more >Troubleshooting in Python - Plotly
In general you must also have the correct version of the underlying Plotly.js rendering engine installed, and the way to do that depends...
Read more >Performance | Dash for Python Documentation | Plotly
There are three main ways to speed up Dash apps: caching, using WebGL chart types, and implementing clientside callbacks.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is because the updated vscode-notebook-renderer extension has not made it to a release yet, see https://github.com/microsoft/vscode-notebook-renderers/issues/102
Would be nice if the renderer could be released with a similar cadence than the Jupyter extension and integrating the latest dependencies like Plotly.
Don’s PR should have fixed the immediate issue. The longer term idea of just using the installed plotly.min.js can be tracked as an enhancement I think.