text_on_color

Contents

text_on_color#

treescope.figures.text_on_color(text: str, value: float, vmax: float = 1.0, vmin: float | None = None, colormap: list[tuple[int, int, int]] | None = None) figures_impl.TreescopeFigure[source]#

Renders some text on colored background, with the default colormap.

Parameters:
  • text – Text to display.

  • value – Value to color the background with.

  • vmax – Maximum value for the colormap.

  • vmin – Minimum value for the colormap. Defaults to -vmax.

  • colormap – Explicit colormap to use. If not provided, uses the default diverging colormap if vmin is not provided, or the default sequential colormap if vmin is provided.

Returns:

A rendering of this word, formatted similarly to how this value would be formatted in an array visualization.