Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 37 additions & 31 deletions plotly/graph_objs/_figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Modifications will be overwitten the next time code generation run.

from plotly.basedatatypes import BaseFigure
from plotly.graph_objs import Table


class Figure(BaseFigure):
Expand Down Expand Up @@ -19507,37 +19508,42 @@ def add_table(
-------
Figure
"""
from plotly.graph_objs import Table

new_trace = Table(
cells=cells,
columnorder=columnorder,
columnordersrc=columnordersrc,
columnwidth=columnwidth,
columnwidthsrc=columnwidthsrc,
customdata=customdata,
customdatasrc=customdatasrc,
domain=domain,
header=header,
hoverinfo=hoverinfo,
hoverinfosrc=hoverinfosrc,
hoverlabel=hoverlabel,
ids=ids,
idssrc=idssrc,
legend=legend,
legendgrouptitle=legendgrouptitle,
legendrank=legendrank,
legendwidth=legendwidth,
meta=meta,
metasrc=metasrc,
name=name,
stream=stream,
uid=uid,
uirevision=uirevision,
visible=visible,
**kwargs,
)
return self.add_trace(new_trace, row=row, col=col)
# Optimization: Table constructor all args supplied in single pass using local variable dict
# This reduces the Python function call setup overhead and makes the call more cache-friendly
table_args = {
"cells": cells,
"columnorder": columnorder,
"columnordersrc": columnordersrc,
"columnwidth": columnwidth,
"columnwidthsrc": columnwidthsrc,
"customdata": customdata,
"customdatasrc": customdatasrc,
"domain": domain,
"header": header,
"hoverinfo": hoverinfo,
"hoverinfosrc": hoverinfosrc,
"hoverlabel": hoverlabel,
"ids": ids,
"idssrc": idssrc,
"legend": legend,
"legendgrouptitle": legendgrouptitle,
"legendrank": legendrank,
"legendwidth": legendwidth,
"meta": meta,
"metasrc": metasrc,
"name": name,
"stream": stream,
"uid": uid,
"uirevision": uirevision,
"visible": visible,
}
# Merge in **kwargs
if kwargs:
table_args.update(kwargs)
new_trace = Table(**table_args)
# Micro-optimization: Inline method call to add_trace as local var to avoid attribute lookup
parent_add_trace = self.add_trace
return parent_add_trace(new_trace, row=row, col=col)

def add_treemap(
self,
Expand Down