8000 Check at least one argument is provided for plt.table · matplotlib/matplotlib@1e54084 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1e54084

Browse files 8000
committed
Check at least one argument is provided for plt.table
1 parent 57c845b commit 1e54084

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5873,10 +5873,10 @@ def table(self, **kwargs):
58735873
colLabels=None, colColours=None, colLoc='center',
58745874
loc='bottom', bbox=None):
58755875
5876-
Returns a :class:`matplotlib.table.Table` instance. For finer
5877-
grained control over tables, use the
5878-
:class:`~matplotlib.table.Table` class and add it to the axes
5879-
with :meth:`~matplotlib.axes.Axes.add_table`.
5876+
Returns a :class:`matplotlib.table.Table` instance. Either `cellText`
5877+
or `cellColours` must be provided. For finer grained control over
5878+
tables, use the :class:`~matplotlib.table.Table` class and add it to
5879+
the axes with :meth:`~matplotlib.axes.Axes.add_table`.
58805880
58815881
Thanks to John Gill for providing the class and table.
58825882

lib/matplotlib/table.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,10 @@ def table(ax,
581581
Thanks to John Gill for providing the class and table.
582582
"""
583583

584+
if cellColours is None and cellText is None:
585+
raise ValueError('At least one argument from "cellColours" or '
586+
'"cellText" must be provided to create a table.')
587+
584588
# Check we have some cellText
585589
if cellText is None:
586590
# assume just colours are needed

0 commit comments

Comments
 (0)
0