Skip to content

Latest commit

 

History

History
54 lines (48 loc) · 1.2 KB

File metadata and controls

54 lines (48 loc) · 1.2 KB
jupytext
cell_metadata_filter formats text_representation
-all
md:myst
extension format_name format_version jupytext_version
.md
myst
0.13
1.11.5
kernelspec
display_name language name
Python 3
python
python3

Use different colormaps

This example shows how to use different colormaps.

import numpy as np
from brainplotlib import brain_plot
import matplotlib.pyplot as plt

rng = np.random.default_rng(0)
v = rng.random((1175, ))
The `cmap` parameter of `brain_plot` can use any `matplotlib` colormaps in a similar way as `plt.plot`.
:tags: ["remove-output"]
fig, axs = plt.subplots(2, 2, dpi=300, figsize=([_/300 + 1 for _ in [1728, 1560]]))
cmaps = ['viridis', 'jet', 'bwr', 'plasma']
for i in range(2):
    for j in range(2):
        ax = axs[i][j]
        cmap = cmaps[i*2+j]
        img = brain_plot(v, vmax=1, vmin=0, cmap=cmap)
        ax.imshow(img)
        ax.axis('off')
        ax.set_title(cmap)
plt.show()
:tags: ["remove-cell"]
from myst_nb import glue
glue('different_cmaps', fig, display=False)

{{ gallery_link }}