Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Plotly · Class

go.Table

go.Table creates an interactive Plotly table trace for displaying detailed data in a row-and-column grid. Its body data is supplied in column-major order, with styling available for headers, columns, rows, and cells.

How it works

go.Table is a Plotly trace for presenting structured data in a grid. Supply column-oriented vectors through header and cells; styling can be applied at the header, column, row, or cell level.

Syntax

go.Table(header=dict(...), cells=dict(...))

Parameters

NameTypeDescription
headerdictConfiguration object containing the table header values and styling.
cellsdictConfiguration object containing column-oriented body values and styling.

Returns

A Plotly Table trace object.

Key points

  • Use go.Table when a figure needs a structured, detailed view of data.
  • The trace renders data as a two-dimensional table-like grid.
  • Formatting can target the header, complete columns, rows, or individual cells.
  • Represent the body as a list of column vectors, with corresponding positions forming rows.
  • The table reference page is the place to consult for the complete attribute set.

Common mistakes

  • Provide cell data as one vector per column, rather than as row-oriented records.
  • A table is positioned through its domain rather than Cartesian x- and y-axes.

Example: Create a table trace

import plotly.graph_objects as go

fig = go.Figure(data=[go.Table(
    header=dict(values=["A Scores", "B Scores"]),
    cells=dict(values=[[100, 90, 80, 90], [95, 85, 75, 95]])
)])
fig.show()

Creates a Plotly figure containing a table with two columns and four data rows, then displays it.

When to use it

Data summaries

Presenting a compact report or scorecard inside a Plotly figure.

Chart-and-table dashboards

Displaying tabular values alongside charts in an interactive dashboard.

Formatted tables

Applying separate formatting to headings and data regions.

Interview questions

QWhat is go.Table used for, and how are its values organized?

go.Table creates a table trace whose data is arranged as rows and columns. Its cell values use column-major order, so each inner vector represents one column.

Follow-up: How would you place it beside a Cartesian trace? Define a table subplot type and add the table trace there, while keeping Cartesian traces in an xy subplot.

QHow do you define and style a table?

The header configuration supplies header values, while cells supplies the displayed body values. Both can also carry presentation settings such as fill, line, font, and alignment.

Follow-up: How would you style only one part of the table? Apply the relevant styling property at the header, column, row, or cell level supported by the trace.

QHow is a table positioned in a figure?

A table is not positioned with Cartesian axes. Its location in the plotting area is controlled by the trace domain.

Follow-up: What should be checked when combining a table with ordinary plots? Ensure the subplot configuration uses the appropriate table type instead of assuming every trace belongs to an xy subplot.

  • go.Figure
  • go.Table.header
  • go.Table.cells
  • table.domain

Source: Tables in Python. Checked 2026-10-15.