Skip to content

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

Closed

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

  1. emilykl commented on Sep 3, 2026

    @emilykl
    Contributor

    Hi @techno-phile, thanks for the report. As you mentioned I'm not able to reproduce the issue in a blank notebook (though I do see a larger-than-expected amount of blank space under the figure). If you're able to share a notebook which reliably reproduces the issue, that would be very helpful.

    Could you try replacing fig.show() with fig.show(renderer="notebook") and let us know if you see the same issue? If that resolves the problem, I have an idea of what needs to be fixed.

  2. techno-phile commented on Sep 3, 2026

    @techno-phile
    Author

    yes fig.show(renderer="notebook") resolved the issue.
    thank you Emily.

  3. emilykl commented on Sep 3, 2026

    @emilykl
    Contributor

    Thanks @techno-phile for confirming! I believe the draft PR I linked above will fix the issue in that case; I'll finalize that PR and get it merged.

    I've verified the fix on my end by building a .whl and installing it in Colab; it resolves the extra-space problem I'm seeing so I suspect it will resolve your issue as well. If you'd be willing to verify the fix on your end by following the same steps, that would be helpful as additional confirmation, but I realize it's a bit of a pain.

  4. emilykl commented on Sep 3, 2026

    @emilykl
    Contributor

    Just putting a few screenshots here, even though I can't reproduce the infinitely-growing issue, I do see a bunch of extra space underneath the plot which is not present with 6.9.0 but appears with 7.0.0:

    v6.9.0
    Image

    v7.0.0
    Image

  5. techno-phile commented on Sep 4, 2026

    @techno-phile
    Author

    The extra space keeps on increasing if there are multiple fig.show in a cell till the cell gets to its max pxl size. the real output is small but the space gets enormous.

    is there anything you want me to do? fig.show(renderer="notebook") fixed it on my side.

  6. emilykl commented on Sep 4, 2026

    @emilykl
    Contributor

    @techno-phile No, you're good! The PR above is merged so the fix will be included in the next plotly release, should be within a few weeks from now.

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