FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Pcolormesh with Gouraud shading: masked arrays by efiring · Pull Request #26072 · matplotlib/matplotlib · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .eps  (1) .pdf  (1) .png  (1) .py  (3) .svg  (1) All 5 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
2 changes: 2 additions & 0 deletions lib/matplotlib/backends/backend_ps.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,8 @@ def draw_gouraud_triangle(self, gc, points, colors, trans):
@_log_if_debug_on
def draw_gouraud_triangles(self, gc, points, colors, trans):
assert len(points) == len(colors)
if len(points) == 0:
return
assert points.ndim == 3
assert points.shape[1] == 3
assert points.shape[2] == 2
Expand Down
8 changes: 6 additions & 2 deletions lib/matplotlib/collections.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -2098,6 +2098,10 @@ def _convert_mesh_to_triangles(self, coordinates):
], axis=2).reshape((-1, 3, 2))

c = self.get_facecolor().reshape((*coordinates.shape[:2], 4))
z = self.get_array()
mask = z.mask if np.ma.is_masked(z) else None
if mask is not None:
c[mask, 3] = np.nan
c_a = c[:-1, :-1]
c_b = c[:-1, 1:]
c_c = c[1:, 1:]
Expand All @@ -2109,8 +2113,8 @@ def _convert_mesh_to_triangles(self, coordinates):
c_c, c_d, c_center,
c_d, c_a, c_center,
], axis=2).reshape((-1, 3, 4))

return triangles, colors
tmask = np.isnan(colors[..., 2, 3])
return triangles[~tmask], colors[~tmask]

@artist.allow_rasterization
def draw(self, renderer):
Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires iframe.
Loading

Back | FazBrowse Home | New Git URL