matplotlib.pyplot.table#
- matplotlib.pyplot.table(cellText=None,cellColours=None,cellLoc='right',colWidths=None,rowLabels=None,rowColours=None,rowLoc='left',colLabels=None,colColours=None,colLoc='center',loc='bottom',bbox=None,edges='closed',**kwargs)[source]#
Add a table to an
Axes
.At least one ofcellText orcellColours must be specified. Theseparameters must be 2D lists, in which the outer lists define the rows andthe inner list define the column values per row. Each row must have thesame number of elements.
The table can optionally have row and column headers, which are configuredusingrowLabels,rowColours,rowLoc andcolLabels,colColours,colLoc respectively.
For finer grained control over tables, use the
Table
class and add it tothe Axes withAxes.add_table
.- Parameters:
- cellText2D list of str or pandas.DataFrame, optional
The texts to place into the table cells.
Note: Line breaks in the strings are currently not accounted for andwill result in the text exceeding the cell boundaries.
- cellColours2D list ofcolor, optional
The background colors of the cells.
- cellLoc{'right', 'center', 'left'}
The alignment of the text within the cells.
- colWidthslist of float, optional
The column widths in units of the axes. If not given, all columns willhave a width of1 / ncols.
- rowLabelslist of str, optional
The text of the row header cells.
- rowColourslist ofcolor, optional
The colors of the row header cells.
- rowLoc{'left', 'center', 'right'}
The text alignment of the row header cells.
- colLabelslist of str, optional
The text of the column header cells.
- colColourslist ofcolor, optional
The colors of the column header cells.
- colLoc{'center', 'left', 'right'}
The text alignment of the column header cells.
- locstr, default: 'bottom'
The position of the cell with respect toax. This must be one ofthe
codes
.- bbox
Bbox
or [xmin, ymin, width, height], optional A bounding box to draw the table into. If this is notNone, thisoverridesloc.
- edges{'closed', 'open', 'horizontal', 'vertical'} or substring of 'BRTL'
The cell edges to be drawn with a line. See also
visible_edges
.
- Returns:
Table
The created table.
- Other Parameters:
- **kwargs
Table
properties.Property
Description
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image
float or None
bool
BboxBase
or Nonebool
Patch or (Path, Transform) or None
float
str
bool
object
bool
list of
AbstractPathEffect
None or bool or float or callable
bool
(scale: float, length: float, randomness: float)
bool or None
str
bool
float
Notes
Note
This is thepyplot wrapper for
axes.Axes.table
.