A simple rich renderable Heatmap.
Project description
rich_heatmap
A simple Heatmap renderable for projects using rich.
Installing
Install with pip or your favorite package manager:
python -m pip install rich_heatmap
uv add rich_heatmap
Usage
Create HeatmapCell objects containing your data:
for row, col in itertools.product(range(30), range(20)):
value = noise.snoise2(col / 10, row / 15)
cells.append(heatmap.HeatmapCell(row, col, value, None, f"{value:0.1f}"))
Values will be normalized into [0, 1] and then mapped to a color
using the colormap function:
EMBER = matplotlib.colormaps['cmr.ember']
def colormap(value: float) -> tuple[float, float, float]:
rgba = EMBER(value)
return rich.color.Color.from_rgb(
255 * rgba[0],
255 * rgba[1],
255 * rgba[2],
)
And then print a Heatmap containing those cells:
print(heatmap.Heatmap(cells=cells, colormap=colormap))
Row and column values will be sorted before printing, so you can accumulate a stream of data and feed it in without any more trouble:
If you don't provide text, the library will produce rectangular cells:
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rich_heatmap-0.1.2.tar.gz.
File metadata
- Download URL: rich_heatmap-0.1.2.tar.gz
- Upload date:
- Size: 1.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8372834a8b0d6f34d72f0f48a4724310e9a777e759323a4c83d05c1cf2f35e19
|
|
| MD5 |
2f0cd54ab6039b5dbebb741ab64297ca
|
|
| BLAKE2b-256 |
37ebb0eb54ee4aece04d107d8106a8123b2ea75d20cb7caa704e830e45ac5f0b
|
Provenance
The following attestation bundles were made for rich_heatmap-0.1.2.tar.gz:
Publisher:
publish.yml on saulrh/rich_heatmap
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rich_heatmap-0.1.2.tar.gz -
Subject digest:
8372834a8b0d6f34d72f0f48a4724310e9a777e759323a4c83d05c1cf2f35e19 - Sigstore transparency entry: 232341563
- Sigstore integration time:
-
Permalink:
saulrh/rich_heatmap@b3330d290b26db8d45d065fa5427b697d0a0e1db -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/saulrh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b3330d290b26db8d45d065fa5427b697d0a0e1db -
Trigger Event:
push
-
Statement type:
File details
Details for the file rich_heatmap-0.1.2-py3-none-any.whl.
File metadata
- Download URL: rich_heatmap-0.1.2-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
799e2ff90d132f483531a69a3e9a43019353abb8921dadeb98c8c80cc1b16425
|
|
| MD5 |
e06c87c0087c26b3d1e59f7561ae6b60
|
|
| BLAKE2b-256 |
e9c729f7d2169adbf18f0741eeb0cab4e6e86011f051f84a4bd0d2e75490c6d3
|
Provenance
The following attestation bundles were made for rich_heatmap-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on saulrh/rich_heatmap
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rich_heatmap-0.1.2-py3-none-any.whl -
Subject digest:
799e2ff90d132f483531a69a3e9a43019353abb8921dadeb98c8c80cc1b16425 - Sigstore transparency entry: 232341564
- Sigstore integration time:
-
Permalink:
saulrh/rich_heatmap@b3330d290b26db8d45d065fa5427b697d0a0e1db -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/saulrh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b3330d290b26db8d45d065fa5427b697d0a0e1db -
Trigger Event:
push
-
Statement type: