-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
FigureWidget does work not from inside an if statement #1861
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The way widgets work is that they render if they are the “output” of a cell, i.e. the last statement. For @interact to work, the widget must be returned from the function. |
@nicolaskruchten I undestand that it currently works like that. But, for the future, is there a reason for the widget not to work when returned from the |
These limitations aren't really Plotly limitations but rather Jupyter/Python limitations that we can't do much about :) |
You may be able to use the if True:
fig = go.Figure()
display(fig) (if you have an older version of ipython, you may need to import it: |
TIL about Thanks a lot! |
|
Encountered in Jupyter Lab.
Take the following 2 cases:
&
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.
the slider appears, but the figure does not.
The text was updated successfully, but these errors were encountered: