Note
Go to the end to download the full example code. or to run this example in your browser via Binder
Show stimuli of Haxby dataset¶
dataset
This example plots an overview of the stimuli used in the Haxby dataset.
from nilearn import datasets
from nilearn.plotting import show
haxby_dataset = datasets.fetch_haxby(n_subjects=1, fetch_stimuli=True)
stimulus_information = haxby_dataset.stimuli
[wrapper] Dataset directory found: /home/runner/work/nilearn/nilearn/nilearn_data/haxby2001
[wrapper] Downloading data from http://data.pymvpa.org/datasets/haxby2001/stimuli-2010.01.14.tar.gz ...
Downloading stimuli-2010.01.14.tar.gz ━━━━━━━━━━━━ 10.5/10.5 42.2 MB/s 0:00:00
MB
[wrapper] ...done. (1 seconds, 0 min)
[wrapper] Extracting data from /home/runner/work/nilearn/nilearn/nilearn_data/haxby2001/ee9e0d5a40146477e9197f0d13da9b32/stimuli-2010.01.14.tar.gz...
[wrapper] .. done.
import matplotlib.pyplot as plt
for stim_type in stimulus_information:
# skip control images, there are too many
if stim_type != "controls":
file_names = stimulus_information[stim_type]
fig, axes = plt.subplots(6, 8)
fig.suptitle(stim_type)
for img_path, ax in zip(file_names, axes.ravel(), strict=False):
ax.imshow(plt.imread(img_path), cmap="gray")
for ax in axes.ravel():
ax.axis("off")
show()
Total running time of the script: (0 minutes 7.101 seconds)
Estimated memory usage: 277 MB






