Skip to main content

Rendering anatomical heatmaps with brainrender and matplotlib

Project description

brainglobe-heatmap

brainglobe-heatmap allows you to create heatmaps, mapping scalar values for each brain region (e.g., number of labelled cells in each region) to a color and creating visualizations in 2D (using matplotlib or 3D (using brainrender).

Hansen_2025_Fig1

2D heatmap generated using matplotlib - adapted from Fig 1. from Hansen et al (2025)

heatmap_3d

3D heatmap generated using brainrender

Usage

For full documentation, please see the BrainGlobe documentation. Examples can be found in the examples directory of this repository.

Quickstart

Installation

pip install brainglobe-heatmap

2D heatmap

import brainglobe_heatmap as bgh

values = dict(  # scalar values for each region
    TH=1,
    RSP=0.2,
    AI=0.4,
    SS=-3,
    MO=2.6,
    PVZ=-4,
    LZ=-3,
    VIS=2,
    AUD=0.3,
    RHP=-0.2,
    STR=0.5,
    CB=0.5,
    FRP=-1.7,
    HIP=3,
    PA=-4,
)


f = bgh.Heatmap(
    values,
    position=5000,
    orientation="frontal",
    vmin=-5,
    vmax=3,
    format="2D",
).show()

3D heatmap

import brainglobe_heatmap as bgh

values = dict(  # scalar values for each region
    TH=1,
    RSP=0.2,
    AI=0.4,
    SS=-3,
    MO=2.6,
    PVZ=-4,
    LZ=-3,
    VIS=2,
    AUD=0.3,
    RHP=-0.2,
    STR=0.5,
    CB=0.5,
    FRP=-1.7,
    HIP=3,
    PA=-4,
)


scene = bgh.Heatmap(
    values,
    position=(8000, 5000, 5000),
    orientation="frontal",
    thickness=1000,
    vmin=-5,
    vmax=3,
    format="3D",
).show()

Seeking help or contributing

We are always happy to help users of our tools, and welcome any contributions. If you would like to get in contact with us for any reason, please see the contact page of our website.

Citing brainglobe-heatmap

If you use brainglobe-heatmap in your work, please cite it as:

Federico Claudi, Adam Tyson, Luigi Petrucco, Mathieu Bourdenx, carlocastoldi, Rami Hamati, & Alessandro Felder. (2024). brainglobe/brainglobe-heatmap. Zenodo. https://doi.org/10.5281/zenodo.10375287

If you use brainrender via brainglobe-heatmap (i.e. for 3D visualisation), please also cite it:

Claudi, F., Tyson, A. L., Petrucco, L., Margrie, T.W., Portugues, R.,  Branco, T. (2021) "Visualizing anatomically registered data with Brainrender&quot; <i>eLife</i> 2021;10:e65751 [doi.org/10.7554/eLife.65751](https://doi.org/10.7554/eLife.65751)

BibTeX:

@article{Claudi2021,
author = {Claudi, Federico and Tyson, Adam L. and Petrucco, Luigi and Margrie, Troy W. and Portugues, Ruben and Branco, Tiago},
doi = {10.7554/eLife.65751},
issn = {2050084X},
journal = {eLife},
pages = {1--16},
pmid = {33739286},
title = {{Visualizing anatomically registered data with brainrender}},
volume = {10},
year = {2021}
}

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

brainglobe_heatmap-0.5.5.tar.gz (15.2 kB view details)

Uploaded Source

Built Distribution

brainglobe_heatmap-0.5.5-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file brainglobe_heatmap-0.5.5.tar.gz.

File metadata

  • Download URL: brainglobe_heatmap-0.5.5.tar.gz
  • Upload date:
  • Size: 15.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for brainglobe_heatmap-0.5.5.tar.gz
Algorithm Hash digest
SHA256 91a8b0c5ed70f27f76602aad47efc6d4b44425d5c0da16c45dc9cec0d9fa4297
MD5 520029e54b09b305d92b954ac5d94043
BLAKE2b-256 61eef9888eb4453f32f663d3f2f40c4426a10f892f5a90c3d957a3bd9b49e458

See more details on using hashes here.

File details

Details for the file brainglobe_heatmap-0.5.5-py3-none-any.whl.

File metadata

File hashes

Hashes for brainglobe_heatmap-0.5.5-py3-none-any.whl
Algorithm Hash digest
SHA256 2bd07f5b61f093ee985b9f917845e9b1eeeb3b756c7f08d01dbf41240b337c5b
MD5 c57ff81d1aa7e5a7dd336467fed2be6c
BLAKE2b-256 713230a1d0fc1f7c5937ffc150bf528d45e0643862e66ef11f77bf34ac81078b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page