Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOC] Fix position of plots in relation to code blocks #3788

Merged
merged 2 commits into from
Jun 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions examples/00_tutorials/plot_python_101.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"""
Basic numerics and plotting with Python
=======================================

A simple example of basic Python numerics and how to
plot it.
"""

#########################################################################
# A simple example of basic Python numerics and how to plot it.

# import numpy: the module providing numerical arrays
import numpy as np

Expand Down
13 changes: 10 additions & 3 deletions examples/01_plotting/plot_haxby_masks.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
Small script to plot the masks of the Haxby dataset.
"""


import matplotlib.pyplot as plt
#########################################################################
# Load Haxby dataset
# ------------------

from nilearn import datasets

Expand All @@ -28,10 +29,16 @@

z_slice = -14

fig = plt.figure(figsize=(4, 5.4), facecolor="k")
#########################################################################
# Plot the masks
# --------------

import matplotlib.pyplot as plt

from nilearn.plotting import plot_anat, show

fig = plt.figure(figsize=(4, 5.4), facecolor="k")

display = plot_anat(
mean_img, display_mode="z", cut_coords=[z_slice], figure=fig
)
Expand Down
4 changes: 2 additions & 2 deletions examples/01_plotting/plot_prob_atlas.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# Load 4D probabilistic atlases
from nilearn import datasets, plotting

# Harvard Oxford Atlasf
# Harvard Oxford Atlas
harvard_oxford = datasets.fetch_atlas_harvard_oxford("cort-prob-2mm")
harvard_oxford_sub = datasets.fetch_atlas_harvard_oxford("sub-prob-2mm")

Expand Down Expand Up @@ -67,8 +67,8 @@
dimension=dim, resolution_mm=res, legacy_format=False
)

#########################################################################
# Visualization

atlas_types = {
"Harvard_Oxford": harvard_oxford.maps,
"Harvard_Oxford sub": harvard_oxford_sub.maps,
Expand Down
3 changes: 2 additions & 1 deletion examples/02_decoding/plot_haxby_stimuli.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
and Overlapping Representations of Faces and Objects in Ventral Temporal
Cortex" (Science 2001)
"""

import matplotlib.pyplot as plt

from nilearn import datasets
Expand All @@ -15,6 +14,8 @@
haxby_dataset = datasets.fetch_haxby(subjects=[], fetch_stimuli=True)
stimulus_information = haxby_dataset.stimuli

#########################################################################

for stim_type in stimulus_information:
# skip control images, there are too many
if stim_type != "controls":
Expand Down
2 changes: 2 additions & 0 deletions examples/03_connectivity/plot_simulated_connectome.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
density=0.1,
)

#########################################################################
# Run connectome estimations and plot the results
from nilearn import plotting

fig = plt.figure(figsize=(10, 7))
Expand Down
7 changes: 1 addition & 6 deletions examples/04_glm_first_level/plot_design_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,4 @@
ax2.set_title("Block design matrix", fontsize=12)
plot_design_matrix(X3, ax=ax3)
ax3.set_title("FIR design matrix", fontsize=12)

#########################################################################
# Let's improve the layout and show the result.

plt.subplots_adjust(left=0.08, top=0.9, bottom=0.21, right=0.96, wspace=0.3)
plt.show()
fig.show()
5 changes: 2 additions & 3 deletions examples/06_manipulating_images/plot_smooth_mean_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
effects that are expected.

"""

from nilearn import datasets, image, plotting

data = datasets.fetch_development_fmri(n_subjects=1)
Expand All @@ -22,14 +21,14 @@

first_epi_file = data.func[0]

# First the compute the mean image, from the 4D series of image
# First compute the mean image, from the 4D series of image
mean_func = image.mean_img(first_epi_file)

#########################################################################
# Then we smooth, with a varying amount of smoothing, from none to 20mm
# by increments of 5mm
for smoothing in range(0, 25, 5):
smoothed_img = image.smooth_img(mean_func, smoothing)
plotting.plot_epi(smoothed_img, title=f"Smoothing {int(smoothing)}mm")


plotting.show()