finesse.utilities.tables.NumberTable
¶
Overview
- class finesse.utilities.tables.NumberTable(table, colnames=None, rownames=None, colfunc=None, bgcolfunc=None, norm=None, numfmt=None, compact=False)[source]¶
Bases:
Table
Create a table of numbers to display via pretty printing or html.
- Parameters
- tablearray or list-of-lists
A two dimensional object containing the values of the table.
- colnamesarray or list, optional
An array or list with the same length as the second dimension of table. These are the column names displayed in the first row. If rownames are given this may contain an additional element to display a name of the rownames.
- rownamesarray or list, optional
An array or list with the same length as the first dimension of table. These are the row names displayed in the first column.
- colfuncfunc, optional
A function to assign colors to all values displayed. It will get called with table as argument and must return an array with shape table.shape + (4,) and type float with color values ranging from 0 to 1. The returned array will be interpreted as RGBA color data, but the the A value will be ignored. If any value in a RGB triple is negative, no color will be applied to the corresponding cell. Accepts matplotlib colormaps.
- bgcolfuncfunc, optional
A function to set the backgroundcolors of the cells, works like colorfunc.
- normfunc, optional
This function is applied to the table data before passing it to the color functions. This is intended for normalization functions from matplotlib.colors when using matplotlib colormaps, but can be useful with other functions like numpy.gradient.
- numfmtstr or func or array, optional
Either a function to format numbers or a formatting string. The function must return a string. Can also be an array with one option per row, column or cell.
- compactboolean, optional
Skip internal row separators to save space when printing as string.
Methods
|
|
|
Calculate the colors for the table. |
|
Convert obj to a string using self.number_format[row, column]. |