Skip to content

Commit

Permalink
Merge pull request #1993 from mdboom/ps-gouraud
Browse files Browse the repository at this point in the history
PS backend fails to savefig() pcolormesh with gouraud shading
  • Loading branch information
mdboom committed May 16, 2013
2 parents f3f3450 + 5301872 commit accd49c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/matplotlib/backends/backend_ps.py
Expand Up @@ -824,14 +824,13 @@ def draw_gouraud_triangles(self, gc, points, colors, trans):
assert colors.shape[1] == 3
assert colors.shape[2] == 4

points = trans.transform(points)

shape = points.shape
flat_points = points.reshape((shape[0] * shape[1], 2))
flat_points = trans.transform(flat_points)
flat_colors = colors.reshape((shape[0] * shape[1], 4))
points_min = np.min(flat_points, axis=0) - (1 << 8)
points_max = np.max(flat_points, axis=0) + (1 << 8)
factor = float(0xffffffff) / (points_max - points_min)
points_min = np.min(flat_points, axis=0) - (1 << 12)
points_max = np.max(flat_points, axis=0) + (1 << 12)
factor = np.ceil(float(2 ** 32 - 1) / (points_max - points_min))

xmin, ymin = points_min
xmax, ymax = points_max
Expand Down

0 comments on commit accd49c

Please sign in to comment.