Open
Description
Jupyterlab always resizes the width of the figure to the width of the notebook. When executing the code below, one can see the figure generated with the correct figure for a very short time, and then it resizes to the full width. Is it related to recent changes to make plotly figures more reactive?
import plotly.graph_objects as go
fig = go.Figure(go.Scatter(y=[2, 3]))
fig.update_layout(width=100)
print(fig)
fig.show()
Inside a fresh environment, with plotly / jupyterlab / widgets versions of our Readme.
No error messages in the console.
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
emmanuelle commentedon Mar 27, 2020
Could this be a consequence of
plotly/plotly.js#4392 ? @antoinerg
antoinerg commentedon Mar 27, 2020
@emmanuelle my guess is that it is not. I assume
responsive
is set to True by default? What happens if you specify bothwidth
ANDheight
?Info about plotly/plotly.js#4392
PR plotly/plotly.js#4392 is meant to resolve Promises returned by resize operations (ie.
Plots.resize
) that are dropped because a new request came in before the work could be done. Prior to this PR, those Promises would be pending forever. With the PR, those Promises will all resolve at the same time when the actual resize operation is performed/finished.emmanuelle commentedon Mar 27, 2020
thank you @antoinerg I will try to set both the width and height
emmanuelle commentedon Mar 28, 2020
Thanks for the great tip @antoinerg indeed if you specify both
width
andheight
it works. Does this give you a hint about what is happening?ned2 commentedon Nov 12, 2020
Running into this problem also. Can confirm that setting both
width
andheight
makes the width be applied.Would be great to get a fix in for this. It took me a while to convince myself that there was some kind of a bug (as opposed to user error) and JupyterLab is increasingly becoming the default notebook experience.