Number

Download this notebook from GitHub (right-click to download).


In [1]:
import panel as pn

pn.extension()

The Number is a value indicator providing a visual representation of a value, which may be colored according to provided thresholds.

Parameters:

For layout and styling related parameters see the customization user guide.

  • colors (list): Color thresholds for the Number indicator, specified as a tuple of the absolute thresholds and the color to switch to.
  • default_color (str, default='black'): The color of the Number indicator if no colors are provided
  • format (str, default='{value}'): A formatter string which accepts a {value}.
  • font_size (str, default='54pt'): The size of number itself.
  • nan_format str(str, default='-'): How to format nan values.
  • title_size (str, default='18pt'): The size of number title.
  • value (int or float): The value of the number indicator.

The Number indicator can be used to indicate a simple number and formatted as needed:

In [2]:
pn.indicators.Number(name='Failure Rate', value=10, format='{value}%')
Out[2]:

If we want to specify specific thresholds at which the indicator changes color:

In [3]:
number = pn.indicators.Number(
    name='Failure Rate', value=72, format='{value}%',
    colors=[(33, 'green'), (66, 'gold'), (100, 'red')]
)

pn.Row(number.clone(value=10), number.clone(value=42), number.clone(value=93))
Out[3]:

Download this notebook from GitHub (right-click to download).