Skip to content

Cannot specify figure width with Jupyterlab #2324

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

Open
emmanuelle opened this issue Mar 27, 2020 · 5 comments
Open

Cannot specify figure width with Jupyterlab #2324

emmanuelle opened this issue Mar 27, 2020 · 5 comments
Labels
bug something broken P3 backlog

Comments

@emmanuelle
Copy link
Contributor

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()

image

Inside a fresh environment, with plotly / jupyterlab / widgets versions of our Readme.

No error messages in the console.

@emmanuelle
Copy link
Contributor Author

Could this be a consequence of
plotly/plotly.js#4392 ? @antoinerg

@antoinerg
Copy link
Contributor

antoinerg commented 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 both width AND height?

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
Copy link
Contributor Author

thank you @antoinerg I will try to set both the width and height

@emmanuelle
Copy link
Contributor Author

Thanks for the great tip @antoinerg indeed if you specify both width and height it works. Does this give you a hint about what is happening?

@emmanuelle emmanuelle added the bug something broken label Mar 28, 2020
@ned2
Copy link
Contributor

ned2 commented Nov 12, 2020

Running into this problem also. Can confirm that setting both width and height 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.

@gvwilson gvwilson self-assigned this Jun 18, 2024
@gvwilson gvwilson removed their assignment Aug 2, 2024
@gvwilson gvwilson added the P3 backlog label Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken P3 backlog
Projects
None yet
Development

No branches or pull requests

4 participants