Check at least one argument is provided for plt.table #7522

Merged
merged 1 commit into from Nov 28, 2016
@@ -5873,10 +5873,10 @@ def table(self, **kwargs):
colLabels=None, colColours=None, colLoc='center',
loc='bottom', bbox=None):
- Returns a :class:`matplotlib.table.Table` instance. For finer
- grained control over tables, use the
- :class:`~matplotlib.table.Table` class and add it to the axes
- with :meth:`~matplotlib.axes.Axes.add_table`.
+ Returns a :class:`matplotlib.table.Table` instance. Either `cellText`
+ or `cellColours` must be provided. For finer grained control over
+ tables, use the :class:`~matplotlib.table.Table` class and add it to
+ the axes with :meth:`~matplotlib.axes.Axes.add_table`.
Thanks to John Gill for providing the class and table.
View
@@ -581,6 +581,10 @@ def table(ax,
Thanks to John Gill for providing the class and table.
"""
+ if cellColours is None and cellText is None:
+ raise ValueError('At least one argument from "cellColours" or '
+ '"cellText" must be provided to create a table.')
+
# Check we have some cellText
if cellText is None:
# assume just colours are needed