This release is a pre-release and may not be stable for production use.
anatplot
anatplot is a Python package for plotting data on brain surfaces and visualizing anatomical regions in 3D. You can optionally add electrode contacts to any plot, then save a Matplotlib figure or explore and export the 3D scene.
This project is under active development; some features may need further refinement.
Requires Python 3.10 or newer. Install from GitHub:
uv add "git+https://github.com/const7/anatplot.git"
# Or with pip:
pip install "git+https://github.com/const7/anatplot.git"
Quick start
Plot a public Neurosynth default-mode association map and an example electrode contact on inflated cortical surfaces. Dataset helpers download and cache the public data on first use.
import matplotlib.pyplot as plt
import numpy as np
from anatplot import SurfacePlot, datasets
# Fetch surfaces and a map with matching fsLR 32k vertex order.
surfaces = datasets.fetch_surfaces("fsLR", surface="inflated", density="32k")
left, right = datasets.fetch_dmn_map_fslr32k()
association = {
# Hide this map's zero background so the underlying surface stays visible.
"left": np.ma.masked_equal(left, 0),
"right": np.ma.masked_equal(right, 0),
}
# The with block closes the 3D scene and releases graphics resources.
with SurfacePlot(
**surfaces,
views=["lateral", "medial"],
layout="grid",
window_size=(1000, 600),
zoom=1.5,
) as plot:
plot.add_layer(association, cmap="YlOrRd", cbar=True, cbar_label="Association Z")
# Use the original anatomy's RAS coordinates in millimetres;
# the fetched projection surfaces transfer contacts to the inflated display.
plot.add_contacts([[-64, -13, 23]], radius=4, color="royalblue")
fig = plot.to_figure(figsize=(10, 7))
fig.savefig("surface-map.png", dpi=300)
plt.close(fig)
See the documentation for more.
Acknowledgements
SurfacePlot was inspired by surfplot.
Public templates and atlases come from neuromaps,
TemplateFlow, Nilearn,
and NetNeuroLab. Cite the data used in your figure;
see dataset sources.
Contributing
Issues and pull requests are welcome. Please see the contributing guide before getting started.
Metadata
Release files for anatplot 0.1.0.dev0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| anatplot-0.1.0.dev0.tar.gz | 1.4 MB | Without provenance | Details for anatplot-0.1.0.dev0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| anatplot-0.1.0.dev0-py3-none-any.whl | Python 3 | none | any | Details for anatplot-0.1.0.dev0-py3-none-any.whl |
Total release size: 1.4 MB
Release files / anatplot-0.1.0.dev0.tar.gz
| Download URL | anatplot-0.1.0.dev0.tar.gz |
|---|---|
| Size | 1.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8a05b85a742939c29d21f51395f2c8eaff6c1628131840f533874df518dc813f
|
|
BLAKE2b-256 checksum How to use checksums |
5449fb70733001f479c34f8cf89427103526d72e1444f14572d29482075c77db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / anatplot-0.1.0.dev0-py3-none-any.whl
| Download URL | anatplot-0.1.0.dev0-py3-none-any.whl |
|---|---|
| Size | 30.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d2aa50424ceb281c10b63d1a4a302879841af5a85ea0cc0a2c759d5f320b68e8
|
|
BLAKE2b-256 checksum How to use checksums |
4580a409c03981b9fcc81f6ff3b731a18701b719e9b9fb637ce599edc3933151
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for anatplot 0.1.0.dev0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.