.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/plot_colourmap_pitfalls.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_auto_examples_plot_colourmap_pitfalls.py: ================== Colormap pitfalls. ================== Choosing the right colormap is important. A bad colormap like ``jet`` (standard in ROOT and matplotlib < 2.0) fools you into seeing structure where there isn't any. .. GENERATED FROM PYTHON SOURCE LINES 12-32 .. image-sg:: /auto_examples/images/sphx_glr_plot_colourmap_pitfalls_001.png :alt: gray, jet, cubehelix, cividis :srcset: /auto_examples/images/sphx_glr_plot_colourmap_pitfalls_001.png :class: sphx-glr-single-img .. code-block:: Python import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1 import make_axes_locatable import km3pipe.style km3pipe.style.use("km3pipe") x = np.linspace(-np.pi, np.pi, 300) xx, yy = np.meshgrid(x, x) z = np.cos(xx) + np.cos(yy) fig, axes = plt.subplots(2, 2) for ax, colourmap in zip(axes.flatten(), ["gray", "jet", "cubehelix", "cividis"]): ax.set_title(colourmap) im = ax.imshow(z, cmap=plt.get_cmap(colourmap)) divider = make_axes_locatable(ax) cax = divider.append_axes("right", size="7%", pad=0.05) cbar = plt.colorbar(im, cax=cax) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.303 seconds) .. _sphx_glr_download_auto_examples_plot_colourmap_pitfalls.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_colourmap_pitfalls.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_colourmap_pitfalls.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_