Raxol.UI.Charts.Heatmap (Raxol v2.6.0)

View Source

2D heatmap with background-color intensity mapping.

Renders a grid of values as colored cells, using built-in or custom color scales. Each grid cell maps to one terminal character with the heat value encoded as the background color.

Summary

Functions

Maps a normalized value (0.0-1.0) to a cool-scale color. Blue -> Cyan -> White.

Maps a normalized value (0.0-1.0) to a diverging-scale color. Blue -> White -> Red.

Renders a heatmap from a 2D grid (list of lists, row-major).

Maps a normalized value (0.0-1.0) to a warm-scale color. Green -> Yellow -> Red.

Types

cell()

Functions

cool_scale(t)

@spec cool_scale(float()) :: atom()

Maps a normalized value (0.0-1.0) to a cool-scale color. Blue -> Cyan -> White.

diverging_scale(t)

@spec diverging_scale(float()) :: atom()

Maps a normalized value (0.0-1.0) to a diverging-scale color. Blue -> White -> Red.

render(region, data, opts \\ [])

@spec render(
  {non_neg_integer(), non_neg_integer(), pos_integer(), pos_integer()},
  [[number()]],
  keyword()
) :: [cell()]

Renders a heatmap from a 2D grid (list of lists, row-major).

Options

  • color_scale -- :warm, :cool, :diverging, or a function (value, min, max) -> {fg, bg} (default: :warm)
  • show_values -- render truncated values in cells (default: false)
  • min -- explicit minimum (default: :auto)
  • max -- explicit maximum (default: :auto)
  • cell_char -- character to fill cells with (default: " ")

warm_scale(t)

@spec warm_scale(float()) :: atom()

Maps a normalized value (0.0-1.0) to a warm-scale color. Green -> Yellow -> Red.