.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/01_plotting/plot_colormaps.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_colormaps.py: Matplotlib colormaps in Nilearn =============================== Visualize HCP connectome workbench color maps shipped with Nilearn which can be used for plotting brain images on surface. See :ref:`surface-plotting` for surface plotting details. .. GENERATED FROM PYTHON SOURCE LINES 12-14 Plot color maps --------------- .. GENERATED FROM PYTHON SOURCE LINES 14-37 .. code-block:: Python try: import matplotlib.pyplot as plt except ImportError: raise RuntimeError("This script needs the matplotlib library") import numpy as np from nilearn.plotting import show from nilearn.plotting.cm import _cmap_d as nilearn_cmaps nmaps = len(nilearn_cmaps) a = np.outer(np.arange(0, 1, 0.01), np.ones(10)) # Initialize the figure plt.figure(figsize=(10, 4.2)) plt.subplots_adjust(top=0.4, bottom=0.05, left=0.01, right=0.99) for index, cmap in enumerate(nilearn_cmaps): plt.subplot(1, nmaps + 1, index + 1) plt.imshow(a, cmap=nilearn_cmaps[cmap]) plt.axis("off") plt.title(cmap, fontsize=10, va="bottom", rotation=90) .. image-sg:: /auto_examples/01_plotting/images/sphx_glr_plot_colormaps_001.png :alt: cold_hot, cold_hot_r, cold_white_hot, cold_white_hot_r, brown_blue, brown_blue_r, cyan_copper, cyan_copper_r, cyan_orange, cyan_orange_r, blue_red, blue_red_r, brown_cyan, brown_cyan_r, purple_green, purple_green_r, purple_blue, purple_blue_r, blue_orange, blue_orange_r, black_blue, black_blue_r, black_purple, black_purple_r, black_pink, black_pink_r, black_green, black_green_r, black_red, black_red_r, ocean_hot, ocean_hot_r, hot_white_bone, hot_white_bone_r, hot_black_bone, hot_black_bone_r, bwr, bwr_r, red_transparent, red_transparent_full_alpha_range, green_transparent, green_transparent_full_alpha_range, blue_transparent, blue_transparent_full_alpha_range, roy_big_bl, videen_style :srcset: /auto_examples/01_plotting/images/sphx_glr_plot_colormaps_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 38-40 Plot matplotlib color maps -------------------------- .. GENERATED FROM PYTHON SOURCE LINES 40-59 .. code-block:: Python plt.figure(figsize=(10, 5)) plt.subplots_adjust(top=0.8, bottom=0.05, left=0.01, right=0.99) deprecated_cmaps = ["Vega10", "Vega20", "Vega20b", "Vega20c", "spectral"] m_cmaps = [ m for m in plt.cm.datad if not m.endswith("_r") and m not in deprecated_cmaps ] m_cmaps.sort() for index, cmap in enumerate(m_cmaps): plt.subplot(1, len(m_cmaps) + 1, index + 1) plt.imshow(a, cmap=plt.get_cmap(cmap), aspect="auto") plt.axis("off") plt.title(cmap, fontsize=10, va="bottom", rotation=90) show() .. image-sg:: /auto_examples/01_plotting/images/sphx_glr_plot_colormaps_002.png :alt: Accent, Blues, BrBG, BuGn, BuPu, CMRmap, Dark2, GnBu, Greens, Greys, OrRd, Oranges, PRGn, Paired, Pastel1, Pastel2, PiYG, PuBu, PuBuGn, PuOr, PuRd, Purples, RdBu, RdGy, RdPu, RdYlBu, RdYlGn, Reds, Set1, Set2, Set3, Spectral, Wistia, YlGn, YlGnBu, YlOrBr, YlOrRd, afmhot, autumn, binary, bone, brg, bwr, cool, coolwarm, copper, cubehelix, flag, gist_earth, gist_gray, gist_heat, gist_ncar, gist_rainbow, gist_stern, gist_yarg, gnuplot, gnuplot2, gray, hot, hsv, jet, nipy_spectral, ocean, pink, prism, rainbow, seismic, spring, summer, tab10, tab20, tab20b, tab20c, terrain, winter :srcset: /auto_examples/01_plotting/images/sphx_glr_plot_colormaps_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 3.689 seconds) **Estimated memory usage:** 18 MB .. _sphx_glr_download_auto_examples_01_plotting_plot_colormaps.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_colormaps.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_colormaps.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_colormaps.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_