Skip to content

Commit 07f4acd

Browse files
committed
FIX: replace pylab by matplotlib import
1 parent d80bf15 commit 07f4acd

File tree

6 files changed

+13
-9
lines changed

6 files changed

+13
-9
lines changed

notebooks/basic_import_workflows.ipynb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@
118118
"metadata": {},
119119
"outputs": [],
120120
"source": [
121-
"%pylab inline\n",
121+
"%matplotlib inline\n",
122+
"import matplotlib.pyplot as plt\n",
122123
"from IPython.display import Image\n",
123124
"smoothwf.write_graph(graph2use='colored', format='png', simple_form=True)\n",
124125
"Image(filename='/output/susan_smooth/graph.png')"

notebooks/basic_interfaces.ipynb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@
6969
"outputs": [],
7070
"source": [
7171
"from nilearn.plotting import plot_anat\n",
72-
"%pylab inline\n",
72+
"%matplotlib inline\n",
73+
"import matplotlib.pyplot as plt\n",
7374
"plot_anat('/data/ds000114/sub-01/ses-test/anat/sub-01_ses-test_T1w.nii.gz', title='original',\n",
7475
" display_mode='ortho', dim=-1, draw_cross=False, annotate=False);"
7576
]

notebooks/basic_nodes.ipynb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,8 @@
198198
"outputs": [],
199199
"source": [
200200
"from nilearn.plotting import plot_anat\n",
201-
"%pylab inline\n",
201+
"%matplotlib inline\n",
202+
"import matplotlib.pyplot as plt\n",
202203
"plot_anat(bet.inputs.in_file, title='BET input', cut_coords=(10,10,10),\n",
203204
" display_mode='ortho', dim=-1, draw_cross=False, annotate=False);\n",
204205
"plot_anat(res.outputs.out_file, title='BET output', cut_coords=(10,10,10),\n",

notebooks/basic_workflow.ipynb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,9 @@
6565
"metadata": {},
6666
"outputs": [],
6767
"source": [
68+
"import numpy as np\n",
6869
"import nibabel as nb\n",
69-
"%pylab inline\n",
70+
"import matplotlib.pyplot as plt\n",
7071
"\n",
7172
"# Let's create a short helper function to plot 3D NIfTI images\n",
7273
"def plot_slice(fname):\n",
@@ -79,8 +80,8 @@
7980
" cut = int(data.shape[-1]/2) + 10\n",
8081
"\n",
8182
" # Plot the data\n",
82-
" imshow(np.rot90(data[..., cut]), cmap=\"gray\")\n",
83-
" gca().set_axis_off()"
83+
" plt.imshow(np.rot90(data[..., cut]), cmap=\"gray\")\n",
84+
" plt.gca().set_axis_off()"
8485
]
8586
},
8687
{

notebooks/example_preprocessing.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@
497497
"outputs": [],
498498
"source": [
499499
"import numpy as np\n",
500-
"import pylab as plt\n",
500+
"import matplotlib.pyplot as plt\n",
501501
"par = np.loadtxt('/output/datasink/preproc/sub-01/task-fingerfootlips/sub-01_ses-test_task-fingerfootlips_bold.par')\n",
502502
"fig, axes = plt.subplots(2, 1, figsize=(15, 5))\n",
503503
"axes[0].set_ylabel('rotation (radians)')\n",

notebooks/handson_preprocessing.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,9 @@
172172
"metadata": {},
173173
"outputs": [],
174174
"source": [
175-
"import pylab as plt\n",
176175
"import nibabel as nb\n",
177176
"%matplotlib inline\n",
177+
"import matplotlib.pyplot as plt\n",
178178
"plt.plot(nb.load(func_file).get_fdata()[32, 32, 15, :]);"
179179
]
180180
},
@@ -1261,7 +1261,7 @@
12611261
"source": [
12621262
"# Plot the motion paramters\n",
12631263
"import numpy as np\n",
1264-
"import pylab as plt\n",
1264+
"import matplotlib.pyplot as plt\n",
12651265
"par = np.loadtxt('/output/work_preproc/_subject_id_07/mcflirt/'\n",
12661266
" 'asub-07_ses-test_task-fingerfootlips_bold_roi_mcf.nii.gz.par')\n",
12671267
"fig, axes = plt.subplots(2, 1, figsize=(15, 5))\n",

0 commit comments

Comments
 (0)