.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "_examples/matplotlib/plot_main01_imshow.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr__examples_matplotlib_plot_main01_imshow.py: 01. ``mpl.imshow`` ------------------- Display data as an image, i.e., on a 2D regular raster. .. GENERATED FROM PYTHON SOURCE LINES 7-27 .. image-sg:: /_examples/matplotlib/images/sphx_glr_plot_main01_imshow_001.png :alt: plot main01 imshow :srcset: /_examples/matplotlib/images/sphx_glr_plot_main01_imshow_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out Out: .. code-block:: none /Users/cbit/Desktop/repositories/github/python-spare-code/main/examples/matplotlib/plot_main01_imshow.py:24: UserWarning: This figure includes Axes that are not compatible with tight_layout, so results might be incorrect. | .. code-block:: default :lineno-start: 8 import matplotlib.pyplot as plt import numpy as np # Fixing random state for reproducibility np.random.seed(19680801) # Display plt.subplot(211) plt.imshow(np.random.random((100, 100))) plt.subplot(212) plt.imshow(np.random.random((100, 100))) # Adjust plt.subplots_adjust(bottom=0.1, right=0.8, top=0.9) cax = plt.axes([0.85, 0.1, 0.075, 0.8]) plt.colorbar(cax=cax) plt.tight_layout() # Show plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.247 seconds) .. _sphx_glr_download__examples_matplotlib_plot_main01_imshow.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_main01_imshow.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_main01_imshow.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_