matplotlib.table
¶Place a table below the x-axis at location loc.
The table consists of a grid of cells.
The grid need not be rectangular and can have holes.
Cells are added by specifying their row and column.
For the purposes of positioning the cell at (0, 0) is assumed to be at the top left and the cell at (max_row, max_col) is assumed to be at bottom right.
You can add additional cells outside this range to have convenient ways of positioning more interesting grids.
Author : John Gill <jng@europe.renre.com> Copyright : 2004 John Gill and John Hunter License : matplotlib license
matplotlib.table.
Cell
(xy, width, height, edgecolor='k', facecolor='w', fill=True, text='', loc=None, fontproperties=None)¶Bases: matplotlib.patches.Rectangle
A cell is a Rectangle with some associated text.
PAD
= 0.1¶auto_set_font_size
(renderer)¶Shrink font size until text fits.
draw
(renderer)¶Draw the Patch
to the given renderer.
get_fontsize
()¶Return the cell fontsize
get_required_width
(renderer)¶Get width required for this cell.
get_text
()¶Return the cell Text intance
get_text_bounds
(renderer)¶Get text bounds in axes co-ordinates.
set_fontsize
(size)¶set_text_props
(**kwargs)¶update the text properties with kwargs
matplotlib.table.
CustomCell
(*args, **kwargs)¶Bases: matplotlib.table.Cell
A subclass of Cell where the sides may be visibly toggled.
get_path
()¶Return a path where the edges specified by _visible_edges are drawn
visible_edges
¶matplotlib.table.
Table
(ax, loc=None, bbox=None, **kwargs)¶Bases: matplotlib.artist.Artist
Create a table of cells.
Table can have (optional) row and column headers.
Each entry in the table can be either text or patches.
Column widths and row heights for the table can be specified.
Return value is a sequence of text, line and patch instances that make up the table
AXESPAD
= 0.02¶FONTSIZE
= 10¶add_cell
(row, col, *args, **kwargs)¶Add a cell to the table.
Parameters: | row : int
col : int
|
---|---|
Returns: |
|
auto_set_column_width
(col)¶Given column indexs in either List, Tuple or int. Will be able to automatically set the columns into optimal sizes.
Here is the example of the input, which triger automatic adjustment on columns to optimal size by given index numbers. -1: the row labling 0: the 1st column 1: the 2nd column
col(List): list of indexs >>>table.auto_set_column_width([-1,0,1])
col(Tuple): tuple of indexs >>>table.auto_set_column_width((-1,0,1))
col(int): index integer >>>table.auto_set_column_width(-1) >>>table.auto_set_column_width(0) >>>table.auto_set_column_width(1)
auto_set_font_size
(value=True)¶Automatically set font size.
codes
= {'best': 0, 'bottom': 17, 'bottom left': 12, 'bottom right': 13, 'center': 9, 'center left': 5, 'center right': 6, 'left': 15, 'lower center': 7, 'lower left': 3, 'lower right': 4, 'right': 14, 'top': 16, 'top left': 11, 'top right': 10, 'upper center': 8, 'upper left': 2, 'upper right': 1}¶contains
(mouseevent)¶Test whether the mouse event occurred in the table.
Returns T/F, {}
draw
(renderer)¶Derived classes drawing method
edges
¶get_celld
()¶return a dict of cells in the table
get_child_artists
()¶Return the Artists contained by the table
get_children
()¶Return the Artists contained by the table
get_window_extent
(renderer)¶Return the bounding box of the table in window coords
scale
(xscale, yscale)¶Scale column widths by xscale and row heights by yscale.
set_fontsize
(size)¶Set the fontsize of the cell text
ACCEPTS: a float in points
matplotlib.table.
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')¶Factory function to generate a Table instance.
Thanks to John Gill for providing the class and table.