{
"cells": [
{
"cell_type": "markdown",
"id": "07ff31fa-cc42-4fca-91f9-e14cac68d495",
"metadata": {},
"source": [
"# Tests and showcase of `PlotlyHelper.heatmap_stack_1D()`"
]
},
{
"cell_type": "markdown",
"id": "a4ac7c71-7d5c-49d2-ba54-ad9d1283d1de",
"metadata": {},
"source": [
"### TAGS : \"visualization\""
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "b4dde9f6-a23f-420b-ac5d-6ff13d0fa1bf",
"metadata": {},
"outputs": [],
"source": [
"LAST_REVISED = \"June 1, 2025\"\n",
"LIFE123_VERSION = \"1.0.0rc6\" # Library version this experiment is based on"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "75fe5508-e143-42ca-9fcf-7f45e841580b",
"metadata": {},
"outputs": [],
"source": [
"#import set_path # Using MyBinder? Uncomment this before running the next cell!"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "be92874b-0d36-4e13-b989-929bae15e224",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"#import sys, os\n",
"#os.getcwd()\n",
"#sys.path.append(\"C:/some_path/my_env_or_install\") # CHANGE to the folder containing your venv or libraries installation!\n",
"# NOTE: If any of the imports below can't find a module, uncomment the lines above, or try: import set_path\n",
"\n",
"import numpy as np\n",
"from life123 import check_version, PlotlyHelper"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "2af9c6db-4218-4609-baac-70c2c1cf1e21",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"OK\n"
]
}
],
"source": [
"check_version(LIFE123_VERSION)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b6f91496-17e6-4fbd-9f56-d55abc805e57",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"id": "eb9cd5c3-4f2c-4d95-8cfd-9b77519f2da7",
"metadata": {},
"source": [
"## A single heatmap"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "f6e70adf-56db-466e-9cbe-8e34281040e9",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"array([[ 0., 0., 100., 10., 0., 0., 50., 0., 25., 0.]])"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data_matrix = np.array([ [0., 0., 100., 10., 0., 0., 50., 0., 25., 0.] \n",
" ])\n",
"data_matrix"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "89ff12b7-67c9-4551-b3de-bdea7ca78729",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"text/html": [
" \n",
" "
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.plotly.v1+json": {
"config": {
"plotlyServerURL": "https://plot.ly"
},
"data": [
{
"colorbar": {
"len": 1.2,
"title": {
"text": "value"
},
"x": 1.02,
"y": 0.5
},
"colorscale": [
[
0,
"rgb(254, 254, 253)"
],
[
0.09090909090909091,
"rgb(224, 224, 223)"
],
[
0.18181818181818182,
"rgb(197, 197, 195)"
],
[
0.2727272727272727,
"rgb(171, 171, 170)"
],
[
0.36363636363636365,
"rgb(146, 146, 145)"
],
[
0.45454545454545453,
"rgb(124, 123, 122)"
],
[
0.5454545454545454,
"rgb(102, 101, 101)"
],
[
0.6363636363636364,
"rgb(81, 80, 80)"
],
[
0.7272727272727273,
"rgb(59, 59, 59)"
],
[
0.8181818181818182,
"rgb(38, 38, 38)"
],
[
0.9090909090909091,
"rgb(16, 16, 16)"
],
[
1,
"rgb(0, 0, 0)"
]
],
"hovertemplate": "value: %{z}
Bin #: %{x}
SAMPLE: %{y}