Skip to main content

bsplot Sagittal volume animation Surface rotation animation

Neuroscience plotting utilities built on matplotlib.

Overview

  • Brain surfaces and glass-brain visualizations
  • Volume slicing with anatomical overlays
  • Tractography rendering
  • Publication-ready styles and scientific colormaps
  • Panel helpers for multi-figure layouts
  • Terminal (ASCII) surface backend — render a lit brain as text, with data overlays

Terminal (ASCII) rendering

Render a cortical surface straight to text — no matplotlib figure — as a lit "surface of letters", with optional scalar overlays and parcellations in colour. The default is the folded pial cortex, and the output adapts to wherever it is drawn: terminal (ANSI colour), notebook/website (color_mode="html", auto-selected in a notebook), or README/plain-text (color_mode="none").

import bsplot

bsplot.plot_surf_ascii()                       # pial template brain, lateral
bsplot.plot_surf_ascii(data=my_stat_map)       # scalar overlay, colour-mapped
bsplot.plot_surf_ascii(parcellation=labels)    # coloured regions
bsplot.plot_surf_ascii(width=140)              # width = resolution knob
bsplot.plot_surf_ascii(background="light")     # for a white background
bsplot-ascii                          # pial fsaverage, lateral (or: python -m bsplot.ascii)
bsplot-ascii --view top --hemi both   # both hemispheres, dorsal
bsplot-ascii --html > brain.html      # emit an HTML block
bsplot-ascii --sphere                 # offline demo (no download)

See the Terminal surface guide for ramps, colormaps, views, and resolution.

Timeseries — recordings and simulations

Surface colouring over time, cheap enough to stream live. The geometry is prepared once, so each frame only re-colours the visible faces: ~0.7 ms/frame (>1000 fps) against ~184 ms for a full render.

mov = bsplot.AsciiSurfaceMovie(data, hemi="lh", view="lateral", width=80)
mov.play(fps=20)                    # live in the terminal
mov.to_gif("sim.gif"); mov.to_html("sim.html"); mov.to_cast("sim.cast")

# region-level data (TVB-style) mapped onto the surface by an atlas
bsplot.AsciiSurfaceMovie(data, atlas="DesikanKilliany", region_labels=labels)

# straight from a tvbo simulation result
bsplot.AsciiSurfaceMovie.from_tvbo("exp-3_result.h5", atlas="dk").play()
bsplot-ascii-movie data.npy --atlas Destrieux --fps 20     # play
bsplot-ascii-movie result.h5 --tvbo -o sim.gif             # or export

See the Timeseries guide. Reading tvbo result files needs pip install "bsplot[tvbo]".

alt text

Installation

pip install bsplot

Two optional features — volume-to-surface projection (project_vol_to_surf) and fsaverage cortical flatmaps (get_flat_surface_geometry) — additionally need nilearn:

pip install "bsplot[projection]"

Dependencies

  • matplotlib
  • nibabel
  • scipy
  • templateflow
  • scikit-image
  • nilearn — optional, only for project_vol_to_surf and cortical flatmaps (pip install "bsplot[projection]")

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bsplot-0.0.11.tar.gz (6.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bsplot-0.0.11-py3-none-any.whl (6.3 MB view details)

Uploaded Python 3

File details

Details for the file bsplot-0.0.11.tar.gz.

File metadata

  • Download URL: bsplot-0.0.11.tar.gz
  • Upload date:
  • Size: 6.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for bsplot-0.0.11.tar.gz
Algorithm Hash digest
SHA256 62eb9cb053db380440d7b420989497c081b4c8dc98abf9cbc6718668f594c11d
MD5 ae0e2ae6df9ea801774b17535c7353a3
BLAKE2b-256 ddd03658cec3764756323318e4133711b10406301d6366cbbdb1618e329ef0a8

See more details on using hashes here.

Provenance

The following attestation bundles were made for bsplot-0.0.11.tar.gz:

Publisher: publish-pypi.yml on virtual-twin/bsplot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bsplot-0.0.11-py3-none-any.whl.

File metadata

  • Download URL: bsplot-0.0.11-py3-none-any.whl
  • Upload date:
  • Size: 6.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for bsplot-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 416ef408d7c1e501575ba529f2a7ad6a8dac0324f591d4c480e4099657572859
MD5 d02eeea963ce1271aad607bdd5709b45
BLAKE2b-256 f247fe352cf9f914d388e9244fa9c1d3884a48667582690787d9ab5a3db42f68

See more details on using hashes here.

Provenance

The following attestation bundles were made for bsplot-0.0.11-py3-none-any.whl:

Publisher: publish-pypi.yml on virtual-twin/bsplot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.0.11 This release

2 files

0.0.10

2 files

0.0.9

2 files

0.0.8

2 files

0.0.7

2 files

0.0.6

2 files

0.0.4

1 file

0.0.3

1 file

0.0.2

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page