Skip to content

FigureWidget does work not from inside an if statement #1861

@sursu

Description

@sursu

Encountered in Jupyter Lab.

Take the following 2 cases:

fig = go.FigureWidget()
fig

&

silent=False

if not silent:
    fig = go.FigureWidget()
    fig

The first one produces a figure, the second one does not.
Why don't they behave similarly?

If I use the @interact decorator in the second case.
e.g.

if not silent:
    fig = go.FigureWidget()
    fig.add_scatter()

    @interact(s=(3,5))
    def update(s=3):
        with fig.batch_update():
            fig.data[0].y = np.random.normal(size=s)
    fig

the slider appears, but the figure does not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions