plotly / plotly/plotly.py

Cannot specify figure width with Jupyterlab

Open
#2,324 5 comments 6 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

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.

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 issue with the provided Plotly figure snippet in a fresh environment using the versions from the README. Inspect the JupyterLab figure and widget rendering path; done means an explicit width of 100 remains visible instead of being replaced by the notebook width, with no console errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook, python
Domain
data-visualization
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.