.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/01_plotting/plot_dim_plotting.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code or to run this example in your browser via Binder .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_01_plotting_plot_dim_plotting.py: Controlling the contrast of the background when plotting ======================================================== The `dim` argument controls the contrast of the background. *dim* modifies the contrast of this image: dim=0 leaves the image unchanged, negative values of *dim* enhance it, and positive values decrease it (dim the background). This *dim* argument may also be useful for the plot_roi function used to display ROIs on top of a background image. .. GENERATED FROM PYTHON SOURCE LINES 17-19 Retrieve the data: the localizer dataset with contrast maps ----------------------------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 19-28 .. code-block:: Python from nilearn import datasets localizer_dataset = datasets.fetch_localizer_button_task(legacy_format=False) # Contrast map of motor task localizer_tmap_filename = localizer_dataset.tmap # Subject specific anatomical image localizer_anat_filename = localizer_dataset.anat .. GENERATED FROM PYTHON SOURCE LINES 29-31 Plotting with enhancement of background image with dim=-.5 ---------------------------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 31-43 .. code-block:: Python from nilearn import plotting plotting.plot_stat_map( localizer_tmap_filename, bg_img=localizer_anat_filename, cut_coords=(36, -27, 66), threshold=3, title="dim=-.5", dim=-0.5, ) .. image-sg:: /auto_examples/01_plotting/images/sphx_glr_plot_dim_plotting_001.png :alt: plot dim plotting :srcset: /auto_examples/01_plotting/images/sphx_glr_plot_dim_plotting_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 44-46 Plotting with no change of contrast in background image with dim=0 ------------------------------------------------------------------ .. GENERATED FROM PYTHON SOURCE LINES 46-55 .. code-block:: Python plotting.plot_stat_map( localizer_tmap_filename, bg_img=localizer_anat_filename, cut_coords=(36, -27, 66), threshold=3, title="dim=0", dim=0, ) .. image-sg:: /auto_examples/01_plotting/images/sphx_glr_plot_dim_plotting_002.png :alt: plot dim plotting :srcset: /auto_examples/01_plotting/images/sphx_glr_plot_dim_plotting_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 56-58 Plotting with decrease of contrast in background image with dim=.5 ------------------------------------------------------------------ .. GENERATED FROM PYTHON SOURCE LINES 58-67 .. code-block:: Python plotting.plot_stat_map( localizer_tmap_filename, bg_img=localizer_anat_filename, cut_coords=(36, -27, 66), threshold=3, title="dim=.5", dim=0.5, ) .. image-sg:: /auto_examples/01_plotting/images/sphx_glr_plot_dim_plotting_003.png :alt: plot dim plotting :srcset: /auto_examples/01_plotting/images/sphx_glr_plot_dim_plotting_003.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 68-70 Plotting with more decrease in contrast with dim=1 -------------------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 70-80 .. code-block:: Python plotting.plot_stat_map( localizer_tmap_filename, bg_img=localizer_anat_filename, cut_coords=(36, -27, 66), threshold=3, title="dim=1", dim=1, ) plotting.show() .. image-sg:: /auto_examples/01_plotting/images/sphx_glr_plot_dim_plotting_004.png :alt: plot dim plotting :srcset: /auto_examples/01_plotting/images/sphx_glr_plot_dim_plotting_004.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 7.540 seconds) **Estimated memory usage:** 9 MB .. _sphx_glr_download_auto_examples_01_plotting_plot_dim_plotting.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: binder-badge .. image:: images/binder_badge_logo.svg :target: https://mybinder.org/v2/gh/nilearn/nilearn/main?urlpath=lab/tree/notebooks/auto_examples/01_plotting/plot_dim_plotting.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_dim_plotting.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_dim_plotting.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_