Skip to content

Commit 74273e8

Browse files
Michiel de HoonMichiel de Hoon
Michiel de Hoon
authored and
Michiel de Hoon
committed
Fix for issue #2872. In case of missing values (e.g., zeros when using a logarithmic scale), draw_path_collection may get offsets containing NaN's. In that case, using CGContextTranslateCTM once with translation and once with -translation will not restore the original CTM. This bugfix adds a check for NaN/inf.
1 parent c001797 commit 74273e8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/_macosx.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,6 +1619,8 @@ static int _transformation_converter(PyObject* object, void* pointer)
16191619
translation.x = - (origin.x - translation.x);
16201620
translation.y = - (origin.y - translation.y);
16211621
}
1622+
/* in case of missing values, translation may contain NaN's */
1623+
if (!isfinite(translation.x) || !isfinite(translation.y)) continue;
16221624
CGContextTranslateCTM(cr, translation.x, translation.y);
16231625
}
16241626

0 commit comments

Comments
 (0)