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

Skip to content

Commit accd49c

Browse files
committed
Merge pull request matplotlib#1993 from mdboom/ps-gouraud
PS backend fails to savefig() pcolormesh with gouraud shading
2 parents f3f3450 + 5301872 commit accd49c

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

lib/matplotlib/backends/backend_ps.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -824,14 +824,13 @@ def draw_gouraud_triangles(self, gc, points, colors, trans):
824824
assert colors.shape[1] == 3
825825
assert colors.shape[2] == 4
826826

827-
points = trans.transform(points)
828-
829827
shape = points.shape
830828
flat_points = points.reshape((shape[0] * shape[1], 2))
829+
flat_points = trans.transform(flat_points)
831830
flat_colors = colors.reshape((shape[0] * shape[1], 4))
832-
points_min = np.min(flat_points, axis=0) - (1 << 8)
833-
points_max = np.max(flat_points, axis=0) + (1 << 8)
834-
factor = float(0xffffffff) / (points_max - points_min)
831+
points_min = np.min(flat_points, axis=0) - (1 << 12)
832+
points_max = np.max(flat_points, axis=0) + (1 << 12)
833+
factor = np.ceil(float(2 ** 32 - 1) / (points_max - points_min))
835834

836835
xmin, ymin = points_min
837836
xmax, ymax = points_max

0 commit comments

Comments
 (0)