Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4409dad

Browse files
committed
Adding a temporary pcolormesh snapping rcParam to remove the need to update many baseline images.
1 parent ca088e7 commit 4409dad

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6087,6 +6087,8 @@ def pcolormesh(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
60876087
collection = mcoll.QuadMesh(Nx - 1, Ny - 1, coords,
60886088
antialiased=antialiased, shading=shading,
60896089
**kwargs)
6090+
snap = kwargs.get('snap', rcParams['pcolormesh.snap'])
6091+
collection.set_snap(snap)
60906092
collection.set_alpha(alpha)
60916093
collection.set_array(C)
60926094
collection.set_cmap(cmap)

lib/matplotlib/rcsetup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,6 +1090,7 @@ def _convert_validator_spec(key, conv):
10901090

10911091
## pcolor(mesh) props:
10921092
"pcolor.shading": ["auto", "flat", "nearest", "gouraud"],
1093+
"pcolormesh.snap": validate_bool,
10931094

10941095
## patch props
10951096
"patch.linewidth": validate_float, # line width in points

matplotlibrc.template

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@
131131
#markers.fillstyle: full # {full, left, right, bottom, top, none}
132132

133133
#pcolor.shading : flat
134+
#pcolormesh.snap : True # Whether to snap the mesh to pixel boundaries. This
135+
# is provided solely to allow old test images to remain
136+
# unchanged. Set to False to obtain the previous behavior.
134137

135138
## ***************************************************************************
136139
## * PATCHES *

0 commit comments

Comments
 (0)