.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/gridded_plots/pcolormesh_basic.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_examples_gridded_plots_pcolormesh_basic.py: Pcolormesh ========== Basic gridded heatmap with a per-axes colorbar. .. GENERATED FROM PYTHON SOURCE LINES 7-34 .. image-sg:: /examples/gridded_plots/images/sphx_glr_pcolormesh_basic_001.png :alt: pcolormesh (Gridded) :srcset: /examples/gridded_plots/images/sphx_glr_pcolormesh_basic_001.png :class: sphx-glr-single-img .. code-block:: Python import numpy as np import matplotlib.pyplot as plt from emcpy.plots.plots import GriddedPlot from emcpy.plots.create_plots import CreatePlot, CreateFigure x = np.linspace(-3, 3, 150) y = np.linspace(-2, 2, 120) X, Y = np.meshgrid(x, y) Z = np.sin(X) * np.cos(2 * Y) p = CreatePlot() g = GriddedPlot(X, Y, Z) g.cmap = "viridis" p.plot_layers = [g] p.add_title("pcolormesh (Gridded)") p.add_xlabel("x") p.add_ylabel("y") p.add_grid() p.add_colorbar(label="value") fig = CreateFigure(nrows=1, ncols=1, figsize=(7.5, 4.5)) fig.plot_list = [p] fig.create_figure() fig.tight_layout() plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.122 seconds) .. _sphx_glr_download_examples_gridded_plots_pcolormesh_basic.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: pcolormesh_basic.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: pcolormesh_basic.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: pcolormesh_basic.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_