Skip to content

graph_objects.Table element takes up too much vertical space #3480

Closed

Description

@frobnitzem

Plotly is an amazing tool! However, the plotly.graph_objects.Table element takes up way too much vertical space.

This can be observed even inside the tables rendered in the plotly documentation:
https://plotly.com/python/table/

On my firefox browser, the very first table in that page only needs about 150 px of vertical space, but is somehow requesting a height of 525!

The rendered HTML in question looks like:

<g class="table" overflow="visible"
   style="box-sizing: content-box; position: absolute; left: 0px; overflow: visible; shape-rendering: crispedges; pointer-events: all;"
   width="734" height="525" transform="">
<g class="table-control-view"...></g></g>

The other tables on that page have similar issues.

For a work-around, I noticed the dash-sample-apps manually create HTML table elements (e.g. make_dash_table in https://github.com/plotly/dash-sample-apps/blob/main/apps/dash-drug-discovery/helpers.py)

Activity

  1. empet commented on Dec 27, 2021

    @empet

    You can set accordingly the layout height and margin to remove the empty vertical space.

    import plotly.graph_objects as go
    
    fig = go.Figure(go.Table(header=dict(values=['A Scores', 'B Scores']),
                             cells=dict(values=[[100, 90, 80, 90], [95, 85, 75, 95]])))
    fig.update_layout(height=100, margin=dict(t=10, b=2))
    fig.show()
    

    for more details print/display: help(go.layout.Margin)

  2. gvwilson commented on Jun 26, 2024

    @gvwilson
    Contributor

    Hi - we are trying to tidy up the stale issues and PRs in Plotly's public repositories so that we can focus on things that are still important to our community. Since this one has been sitting for several years, I'm going to close it; if it is still a concern, please add a comment letting us know what recent version of our software you've checked it with so that I can reopen it and add it to our backlog. Thanks for your help - @gvwilson

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions