.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "intro/matplotlib/auto_examples/options/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 .. rst-class:: sphx-glr-example-title .. _sphx_glr_intro_matplotlib_auto_examples_options_plot_colormaps.py: Colormaps ========= An example plotting the matplotlib colormaps. .. GENERATED FROM PYTHON SOURCE LINES 7-27 .. image-sg:: /intro/matplotlib/auto_examples/options/images/sphx_glr_plot_colormaps_001.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: /intro/matplotlib/auto_examples/options/images/sphx_glr_plot_colormaps_001.png :class: sphx-glr-single-img .. code-block:: default import numpy as np import matplotlib.pyplot as plt plt.rc('text', usetex=False) a = np.outer(np.arange(0, 1, 0.01), np.ones(10)) plt.figure(figsize=(10, 5)) plt.subplots_adjust(top=0.8, bottom=0.05, left=0.01, right=0.99) maps = [m for m in plt.cm.datad if not m.endswith("_r")] maps.sort() l = len(maps) + 1 for i, m in enumerate(maps): plt.subplot(1, l, i+1) plt.axis("off") plt.imshow(a, aspect='auto', cmap=plt.get_cmap(m), origin="lower") plt.title(m, rotation=90, fontsize=10, va='bottom') plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 1.654 seconds) .. _sphx_glr_download_intro_matplotlib_auto_examples_options_plot_colormaps.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_colormaps.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_colormaps.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_