matplotlib.pyplot.pcolormesh() in Python Last Updated : 28 Apr, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report Matplotlib is a library in Python and it is numerical - mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface. matplotlib.pyplot.pcolormesh() Function: The pcolormesh() function in pyplot module of matplotlib library is used to create a pseudocolor plot with a non-regular rectangular grid. Syntax: matplotlib.pyplot.pcolormesh(\*args, alpha=None, norm=None, cmap=None, vmin=None, vmax=None, shading='flat', antialiased=False, data=None, \*\*kwargs) Parameters: This method accept the following parameters that are described below: C : This parameter contains the values in 2D array which are to be color-mapped.X, Y: These parameter are the coordinates of the quadrilateral corners.cmap : This parameter is a colormap instance or registered colormap name.norm : This parameter is the Normalize instance scales the data values to the canonical colormap range [0, 1] for mapping to colorsvmin, vmax : These parameter are optional in nature and they are colorbar range.alpha : This parameter is a intensity of the color.snap : This parameter is used to snap the mesh to pixel boundaries.edgecolors : This parameter is the color of the edges. {'none', None, 'face', color, color sequence}shading : This parameter is the fill style. It can be flat or gouraud. Returns: This returns the following: mesh : This returns the matplotlib.collections.QuadMesh Below examples illustrate the matplotlib.pyplot.pcolormesh() function in matplotlib.pyplot: Example #1: Python3 # Implementation of matplotlib function import matplotlib.pyplot as plt import numpy as np from matplotlib.colors import LogNorm Z = np.random.rand(25, 25) plt.pcolormesh(Z) plt.title('matplotlib.pyplot.pcolormesh() function Example', fontweight ="bold") plt.show() Output: Example #2: Python3 # Implementation of matplotlib function import matplotlib.pyplot as plt import numpy as np from matplotlib.colors import LogNorm dx, dy = 0.015, 0.05 y, x = np.mgrid[slice(-4, 4 + dy, dy), slice(-4, 4 + dx, dx)] z = (1 - x / 3. + x ** 6 + y ** 3) * np.exp(-x ** 2 - y ** 2) z = z[:-1, :-1] z_min, z_max = -np.abs(z).max(), np.abs(z).max() c = plt.pcolormesh(x, y, z, cmap ='Greens', vmin = z_min, vmax = z_max) plt.colorbar(c) plt.title('matplotlib.pyplot.pcolormesh() function Example', fontweight ="bold") plt.show() Output: Comment More infoAdvertise with us Next Article Matplotlib.pyplot.tick_params() in Python S SHUBHAMSINGH10 Follow Improve Article Tags : Python Python-matplotlib Practice Tags : python Similar Reads Matplotlib.pyplot.psd() in Python Matplotlib is a library in Python and it is numerical - mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface. matplotlib.pyplot.csd() Function The csd() function in pyplot module of matplotlib library is used to plo 3 min read Matplotlib.pyplot.matshow() in Python Matplotlib is an amazing visualization library in Python for 2D plots of arrays. Matplotlib is a multi-platform data visualization library built on NumPy arrays and designed to work with the broader SciPy stack. It was introduced by John Hunter in the year 2002. matplotlib.pyplot.matshow() matplotli 2 min read Matplotlib.pyplot.pcolor() function in Python Matplotlib is the well-known Python package used in data visualization. Numpy is the numerical mathematics extension of Matplotlib. Matplotlib is capable of producing high-quality graphs, charts, and figures. Matplotlib produces object-oriented API for embedding plots into projects using GUI toolkit 2 min read Matplotlib.pyplot.tick_params() in Python Matplotlib is a visualization library in Python for 2D plots of arrays. Matplotlib is a multi-platform data visualization library built on NumPy arrays and designed to work with the broader SciPy stack. matplotlib.pyplot.tick_params() matplotlib.pyplot.tick_params() is used to change the appearance 2 min read Matplotlib.pyplot.locator_params() in Python Matplotlib is one of the most popular Python packages used for data visualization. It is a cross-platform library for making 2D plots from data in arrays.Pyplot is a collection of command style functions that make matplotlib work like MATLAB. Note: For more information, refer to Python Matplotlib â 2 min read Matplotlib.axes.Axes.pcolormesh() in Python Matplotlib is a library in Python and it is numerical - mathematical extension for NumPy library. The Axes Class contains most of the figure elements: Axis, Tick, Line2D, Text, Polygon, etc., and sets the coordinate system. And the instances of Axes supports callbacks through a callbacks attribute. 2 min read Like