Matplotlib a multiplatform data visualization library built on NumPy arrays, and designed to work with the broader SciPy stack. Matplotlib has the ability to play well with many operating systems and graphics backends as well. matplotlib.pyplot can also be used for MATLAB-like plotting framework.
Plotting a quadrilateral mesh
pcolormesh() function of the pyplot module is used which is similar to pcolor() function, but pcolor returns PolyCollection whereas pcolormesh returns matplotlib.collections.QuadMesh. pcolormesh is much faster and hence can deal with larger arrays.
Syntax : pcolormesh(cmap = [None | Colormap], alpha = [0<=scalar<=1 | None], edgecolors = [None | color | 'face'], shading = ['gouraud' | 'flat'], norm = [None | Normalize], vimax = [scalar | None], vimin = [scalar | None])
- cmap : It can be None or matplotlib has a number of built-in colormaps accessible via matplotlib.cm.get_cmap
- alpha : It can be None or alpha value between 0 to 1.
- edgecolors :
- If its None, edges will not be visible.
- ‘face’ represents the same color as faces.
- color sequence will set a color.
- shading : It can be either ‘flat’ or ‘gouraud’
- norm : If its None defaults to normalize().
- vimax : It can be either None or the scalar value.
- vimin : It can be either None or the scalar value. ( vimax and vimin are used in conjunction with normalize data)
Example 1 :
Example 2 :
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.