Skip to content

Commit 3d3ef21

Browse files
committed
Update README using example data.
1 parent 1829efa commit 3d3ef21

5 files changed

Lines changed: 11 additions & 13 deletions

File tree

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
BSD 3-Clause License
22

3-
Copyright (c) 2022, The brainplotlib developers
3+
Copyright (c) 2022-2023, The brainplotlib developers
44

55
Redistribution and use in source and binary forms, with or without
66
modification, are permitted provided that the following conditions are met:

README.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[![PyPI](https://img.shields.io/pypi/v/brainplotlib)](https://pypi.org/project/brainplotlib/)
2-
[![PyPI - Downloads](https://img.shields.io/pypi/dm/brainplotlib)](https://pypistats.org/packages/brainplotlib)
2+
[![Downloads](https://static.pepy.tech/badge/brainplotlib)](https://pepy.tech/project/brainplotlib)
33
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/brainplotlib)
44
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.5979819.svg)](https://doi.org/10.5281/zenodo.5979819)
55

66
`brainplotlib` is a Python package that plots data on cortical surface.
77
It's designed to have minimal requirements --- only `NumPy` and `matplotlib`.
88

9-
![brain image](https://github.com/feilong/brainplotlib/raw/main/images/random_data_with_colorbar.png)
9+
![brain image](https://github.com/feilong/brainplotlib/raw/main/images/example_data_with_colorbar.png)
1010

1111
## Installation
1212
The package can be installed with pip:
@@ -20,16 +20,14 @@ pip install brainplotlib
2020

2121
```Python
2222
import numpy as np
23-
from brainplotlib import brain_plot
23+
from brainplotlib import brain_plot, example_data
2424

25-
## Generate some random data
26-
# In this case it's icoorder3 resolution (642 vertices per hemisphere), and
27-
# the non-cortical vertices have been masked out (588 and 587 remaining
25+
# The example_data is icoorder5 resolution (10242 vertices per hemisphere),
26+
# and the non-cortical vertices have been masked out (9372 and 9370 remaining
2827
# vertices for the left and right hemisphere, respectively).
29-
rng = np.random.default_rng(0)
30-
v = rng.random((1175, ))
3128

32-
img, scale = brain_plot(v, vmax=1, vmin=0, cmap='viridis', return_scale=True)
29+
img, scale = brain_plot(
30+
example_data, vmax=10, vmin=-10, cmap='seismic', return_scale=True)
3331
```
3432

3533
The rendered image is a NumPy array.
@@ -40,15 +38,15 @@ fig = plt.figure(figsize=(img.shape[1] / 200, img.shape[0] / 200), dpi=200)
4038
plt.imshow(img)
4139
plt.axis('off')
4240
cbar = plt.colorbar(scale, shrink=0.8, aspect=30)
43-
plt.savefig('random_data_with_colorbar.png', bbox_inches='tight')
41+
plt.savefig('example_data_with_colorbar.png', bbox_inches='tight')
4442
plt.show()
4543
```
4644

4745
Alternatively, the high-resolution image can be saved directly using `OpenCV`.
4846
```Python
4947
import cv2
5048
cv2.imwrite(
51-
'random_data.png',
49+
'example_data.png',
5250
np.round(img[:, :, [2, 1, 0]] * 255).astype(np.uint8))
5351
```
5452

images/example_data.png

710 KB
Loading
785 KB
Loading

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = brainplotlib
3-
version = 0.5.0
3+
version = 1.0.0
44
author = Ma Feilong
55
author_email = mafeilong@gmail.com
66
description = A lightweight package to plot brain surfaces with Python.

0 commit comments

Comments
 (0)