Skip to content

Colab output cell grows unbounded blank space after a Plotly figure — regression starting in plotly.py 7.0.0 #5717

Description

@techno-phile

Colab output cell grows unbounded blank space after a Plotly chart — regression in plotly.py 7.0.0

Summary

In Google Colab, a code cell that calls fig.show() (via plotly.express or plotly.graph_objects) causes that cell's output container to grow to an enormous height, filled with blank space far beyond the actual chart. Scrolling through the output makes the blank area grow further, making it effectively impossible to scroll past it to reach output below. This does not happen with print() or display() — only with Plotly's fig.show().

Bisecting plotly versions (full runtime restart between each test, everything else held constant) isolates this to a regression introduced in plotly.py 7.0.0:

plotly version Result
6.7.0 Clean
6.8.0 Clean
6.9.0 Clean
7.0.0 Reproduces the bug

Environment

  • Google Colab (colab.research.google.com), hosted runtime
  • Python 3.13 (Colab default runtime)
  • plotly installed via pip install plotly --upgrade (no version pin)

Reproduction status

This reproduces reliably in a large, complex private notebook (many cells, many prior fig.show() calls before the affected one). It does not reproduce in a minimal single-chart notebook — we tried the snippet below in a fresh Colab notebook under plotly==7.0.0 and saw no issue:

!pip install plotly==7.0.0
import plotly.express as px

df = px.data.gapminder().query("country == 'Canada'")
fig = px.line(df, x="year", y="lifeExp", title="Test chart")
fig.show()

So whatever triggers this needs more than just "a fig.show() call on 7.0.0" — something about a larger/more complex notebook context matters, and we haven't isolated what. Flagging this rather than claiming a working minimal repro.

Suspected root cause

Comparing fig.to_html() output between plotly 6.9.0 and 7.0.0 for the same figure, two changes stand out in the generated HTML's <head>:

  1. A <!doctype html> declaration was added (switches the embedded iframe document from quirks mode to standards mode).
  2. A new inline style was added: <style>html, body {height: 100%;}</style>.

Forcing height: 100% inside a document that's embedded in an iframe which Colab is itself auto-sizing to fit that content creates a circular sizing dependency — the inner document claims 100% of its container's height while the outer container is sizing itself to the inner content. A resize or intersection event (like scrolling) can force recomputation of both with no stable convergence point, which matches the observed behavior (blank space that grows the more you scroll).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2considered for next cyclebugsomething brokensize: 1

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions