Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e0eb924

Browse filesBrowse files
authored
Merge pull request #26775 from meeseeksmachine/auto-backport-of-pr-26767-on-v3.8.x
2 parents 0267cc1 + 6ce6fe0 commit e0eb924
Copy full SHA for e0eb924

File tree

2 files changed

+22
-0
lines changed
Filter options

2 files changed

+22
-0
lines changed

‎lib/matplotlib/tests/test_transforms.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_transforms.py
+19Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,25 @@ def test_pcolormesh_pre_transform_limits():
142142
assert_almost_equal(expected, ax.dataLim.get_points())
143143

144144

145+
def test_pcolormesh_gouraud_nans():
146+
np.random.seed(19680801)
147+
148+
values = np.linspace(0, 180, 3)
149+
radii = np.linspace(100, 1000, 10)
150+
z, y = np.meshgrid(values, radii)
151+
x = np.radians(np.random.rand(*z.shape) * 100)
152+
153+
fig = plt.figure()
154+
ax = fig.add_subplot(111, projection="polar")
155+
# Setting the limit to cause clipping of the r values causes NaN to be
156+
# introduced; these should not crash but be ignored as in other path
157+
# operations.
158+
ax.set_rlim(101, 1000)
159+
ax.pcolormesh(x, y, z, shading="gouraud")
160+
161+
fig.canvas.draw()
162+
163+
145164
def test_Affine2D_from_values():
146165
points = np.array([[0, 0],
147166
[10, 20],

‎src/_backend_agg.h

Copy file name to clipboardExpand all lines: src/_backend_agg.h
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,6 +1193,9 @@ inline void RendererAgg::_draw_gouraud_triangle(PointArray &points,
11931193
tpoints[i][j] = points(i, j);
11941194
}
11951195
trans.transform(&tpoints[i][0], &tpoints[i][1]);
1196+
if(std::isnan(tpoints[i][0]) || std::isnan(tpoints[i][1])) {
1197+
return;
1198+
}
11961199
}
11971200

11981201
span_alloc_t span_alloc;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.