plotly / plotly/plotly.py

Jupyterlab additional view is not updated

Open
#4,650 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug P3
Dominant language
Python
Stars
18.8k
Forks
2.8k
Avg merge
16h 26m
Merged PRs (30d)
21

Description

If I use jupyterlab with plotly, for example with the simple slider example:

import plotly.graph_objects as go
import numpy as np

# Create figure
fig = go.Figure()

# Add traces, one for each slider step
for step in np.arange(0, 5, 0.1):
    fig.add_trace(
        go.Scatter(
            visible=False,
            line=dict(color="#00CED1", width=6),
            name="𝜈 = " + str(step),
            x=np.arange(0, 10, 0.01),
            y=np.sin(step * np.arange(0, 10, 0.01))))

# Make 10th trace visible
fig.data[10].visible = True

# Create and add slider
steps = []
for i in range(len(fig.data)):
    step = dict(
        method="update",
        args=[{"visible": [False] * len(fig.data)},
              {"title": "Slider switched to step: " + str(i)}],  # layout attribute
    )
    step["args"][0]["visible"][i] = True  # Toggle i'th trace to "visible"
    steps.append(step)

sliders = [dict(
    active=10,
    currentvalue={"prefix": "Frequency: "},
    pad={"t": 50},
    steps=steps
)]

fig.update_layout(
    sliders=sliders
)

fig.show()

from the documentation.
Then, I created an additional view in Jupyter Lab. (Actually, I intend to use a similar mechanism for remote communication in university teaching in a different setup.)
If I move the axis origin or the sliders in the original view, only the original view is updated. Analogously, if I use the additional output for changes, only this output will be updated. On the other hand, after reloading the file and saving it, both views are updated after some time.
So, I assume that a model update is not triggered on the other view after a change.

Can you give me a pointer to what or where I should change? (I may make a PR if I have an idea of what to fix, but I am relatively new to the Jupyter code base and not fluent in Python but in Javascript, where I assume the problem is.)
I have seen that there are some filters, so a message to the kernel is not resent to the js side.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the provided Plotly slider example in JupyterLab with an additional view, then trace the update path for changes made in either view. Done means axis-origin and slider changes in one view update the other without requiring a reload and save; the issue names no repository files or tests to start from.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, jupyter-notebook, python
Domain
data-visualization, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.