Using Font ColorMaps
Contents
Using Font ColorMaps#
Similarly to coloring each ColumnCells background based on its value, you can color each cells text.
You can do this by providing a text_cmap
to a ColumnDefinition
.
Auto-Coloring of text#
You can auto-color text based on the cells backgrounds (or bbox-patches) colors.
You do this after instantiating the table.
autoset_fontcolors(
self, fn: Callable = None, colnames: List[str] = None, **kwargs
) -> Table:
"""Sets the fontcolor of each table cells text based on the facecolor of its rectangle patch.
Args:
fn (Callable, optional):
Callable that takes the rectangle patches facecolor as
rgba-value as argument.
Defaults to plottable.font.contrasting_font_color if fn is None.
kwargs are passed to fn.
Returns:
plottable.table.Table
"""
See also
You can find an example of autosetting fontcolors for specific columns in the Women’s World Cup Example