Closed HolgerPollyNet closed 4 years ago
Such warnings were caused by the upgrade of matplotlib to version >=3.3.x. In previous versions, pcolormesh
does not throw warnings when X, Y match the shape of Z in the flat
shading mode, in which X, Y need to have 1-element more than the respetive dimension of Z. Instead, matplotlib will remove the last row/column of Z to fullfil the requirement of shading. (see the image below)
To eliminate such annoying warnings, we can either change the shading mode from flag
(default) to nearest
, where matplotlib will center the colored quadrilaterals on the grid points. (see the image below)
Or freeze the version of matplotlib to version < 3.3.x.
To make it more user-friendly, I chose the former one. Such fix has been implemented in commit: dbb571b43b86
Warniung message for many plotting ##routines:
MatplotlibDeprecationWarning: shading='flat' when X and Y have the same dimensions as C is deprecated since 3.3. Either specify the corners of the quadrilaterals with X and Y, or pass shading='auto', 'nearest' or 'gouraud', or set rcParams['pcolor.shading']. This will become an error two minor releases later.