question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Enhancement: Use python installed plotly.min.js instead of renderer.

See original GitHub issue

Adding 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:open
  • Created 2 years ago
  • Reactions:1
  • Comments:24 (17 by maintainers)

github_iconTop GitHub Comments

2reactions
jackthepanishercommented, May 5, 2022

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.

2reactions
rchiodocommented, Dec 3, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found