Skip to content

Commit 7fe3c19

Browse files
committed
ENH add ylabel to colorbar in plot_hist_2d
1 parent d11a99f commit 7fe3c19

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

tutorials/notebooks/movies_3T/01_plot_explainable_variance.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"cell_type": "markdown",
1616
"metadata": {},
1717
"source": [
18-
"\n# Compute the explainable variance\n\n\nBefore fitting voxelwise models to the fMRI responses, we can estimate the\n*explainable variance*. The explainable variance is the part of the fMRI\nresponses that can be explained by the voxelwise modeling framework.\n\nIndeed, we can decompose the signal into a sum of two components, one component\nthat is repeated if we repeat the same experiment, and one component that\nchanges for each repeat. Because voxelwise modeling would use the same features\nfor each repeat, it can only model the component that is common to all repeats.\nThis shared component can be estimated by taking the mean over repeats of the\nsame experiment. The variance of this shared component, that we call the\nexplainable variance, is the upper bound of the voxelwise modeling\nperformances.\n"
18+
"\n# Compute the explainable variance\n\n\nBefore fitting voxelwise models to the fMRI responses, we can estimate the\n*explainable variance*. The explainable variance is the part of the fMRI\nresponses that can be explained by the voxelwise modeling framework.\n\nIndeed, we can decompose the signal into a sum of two components, one component\nthat is repeated if we repeat the same experiment, and one component that\nchanges for each repeat. Because voxelwise modeling would use the same features\nfor each repeat, it can only model the component that is common to all repeats.\nThis shared component can be estimated by taking the mean over repeats of the\nsame experiment. The variance of this shared component, that we call the\nexplainable variance, is the upper bound of the voxelwise modeling\nperformances. The explainable variance is also sometimes called the *noise\nceiling*.\n"
1919
]
2020
},
2121
{
@@ -159,7 +159,7 @@
159159
"cell_type": "markdown",
160160
"metadata": {},
161161
"source": [
162-
"This figure is a flatten map of the cortical surface. A number of regions of\ninterest (ROIs) have been labeled to ease the interpretation. If you have\nnever seen such a flatmap, we recommend taking a look at a `pycortex brain\nviewer <https://gallantlab.org/huth2016/>`_, which displays the brain in 3D.\nIn this viewer, press \"I\" to inflate the brain, \"F\" to flatten the surface,\nand \"R\" to reset the view (or use the ``surface/unfold`` cursor on the right\nmenu). This viewer should help you understand the correspondance between the\nflatten and the folded cortical surface of the brain.\n\n"
162+
"This figure is a flatten map of the cortical surface. A number of regions of\ninterest (ROIs) have been labeled to ease the interpretation. If you have\nnever seen such a flatmap, we recommend taking a look at a `pycortex brain\nviewer <https://www.gallantlab.org/brainviewer/Deniz2019>`_, which displays\nthe brain in 3D. In this viewer, press \"I\" to inflate the brain, \"F\" to\nflatten the surface, and \"R\" to reset the view (or use the ``surface/unfold``\ncursor on the right menu). Press \"H\" for a list of all keyboard shortcuts.\nThis viewer should help you understand the correspondance between the flatten\nand the folded cortical surface of the brain.\n\n"
163163
]
164164
},
165165
{

tutorials/notebooks/movies_3T/02_plot_wordnet_model.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@
159159
"cell_type": "markdown",
160160
"metadata": {},
161161
"source": [
162-
"Define the model\n----------------\n\nNow, let's define the model pipeline.\n\nWe first center the features, since we will not use an intercept. Indeed, the\nmean value in fMRI recording is non-informative, so each run is detrended and\ndemeaned independently, and we do not need to predict an intercept value in\nthe linear model.\n\n"
162+
"Define the model\n----------------\n\nNow, let's define the model pipeline.\n\nWe first center the features, since we will not use an intercept. Indeed, the\nmean value in fMRI recording is non-informative, so each run is detrended and\ndemeaned independently, and we do not need to predict an intercept value in\nthe linear model.\n\nHowever, we prefer not to normalize by the standard deviation of each\nfeature. Indeed, if the features are extracted in a consistent way from the\nstimulus, there relative scale is meaningful. Normalizing them independently\nfrom each other would remove this meaning. Moreover, the wordnet features are\none-hot-encoded, which means that each feature is either present (1) or not\npresent (0) in each sample. Normalizing one-hot-encoded features is not\nrecommended, since it would scale disproportionately the infrequent features.\n\n"
163163
]
164164
},
165165
{
@@ -497,7 +497,7 @@
497497
"cell_type": "markdown",
498498
"metadata": {},
499499
"source": [
500-
"We see that the hemodynamic response function (HRF) is captured in the model\nweights. In practice, we can limit the number of features by using only\nthe most informative delays, for example [1, 2, 3, 4].\n\n"
500+
"In this dataset, the brain responses are recorded every two seconds.\n\nWe see that the hemodynamic response function (HRF) is captured in the model\nweights. In practice, we can limit the number of features by using only\nthe most informative delays, for example [1, 2, 3, 4].\n\n"
501501
]
502502
},
503503
{

voxelwise_tutorials/viz.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ def plot_hist2d(scores_1, scores_2, bins=100, cmin=1, vmin=None, vmax=None,
6161
h = ax.hist2d(scores_1, scores_2, bins=bins, cmin=cmin, norm=norm,
6262
**kwargs)
6363
if colorbar:
64-
ax.figure.colorbar(h[3], ax=ax)
64+
cbar = ax.figure.colorbar(h[3], ax=ax)
65+
cbar.ax.set_ylabel('number of voxels')
6566

6667
ax.plot([vmin, vmax], [vmin, vmax], color='k', linewidth=0.5)
6768
ax.set_xlim(vmin, vmax)

0 commit comments

Comments
 (0)