Skip to content

Commit

Permalink
Update README and package information.
Browse files Browse the repository at this point in the history
  • Loading branch information
feilong committed Feb 5, 2022
1 parent 310bdf7 commit e123fdb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
This is a Python package that plots data on cortical surface.

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

## Installation
The package can be installed with pip:
```bash
Expand All @@ -19,16 +21,18 @@ from brainplotlib import brain_plot
rng = np.random.default_rng(0)
v = rng.random((1175, ))

img = brain_plot(v, vmax=1, vmin=0, cmap='viridis')
img, scale = brain_plot(v, vmax=1, vmin=0, cmap='viridis', return_scale=True)
```

The rendered image is a NumPy array.
It can be rendered using `matplotlib`:
```Python
import matplotlib.pyplot as plt
fig = plt.figure(figsize=(img.shape[1] / 100, img.shape[0] / 100), dpi=100)
fig = plt.figure(figsize=(img.shape[1] / 200, img.shape[0] / 200), dpi=200)
plt.imshow(img)
plt.axis('off')
cbar = plt.colorbar(scale, shrink=0.8, aspect=30)
plt.savefig('random_data_with_colorbar.png', bbox_inches='tight')
plt.show()
```

Expand All @@ -39,5 +43,3 @@ cv2.imwrite(
'random_data.png',
np.round(img[:, :, [2, 1, 0]] * 255).astype(np.uint8))
```

![brain image](https://github.com/feilong/brainplotlib/raw/main/images/random_data.png)
Binary file added images/random_data_with_colorbar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = brainplotlib
version = 0.2.0
version = 0.3.0
author = Ma Feilong
author_email = [email protected]
description = A lightweight package to plot brain surfaces with Python.
Expand Down

0 comments on commit e123fdb

Please sign in to comment.