Skip to content

Commit d94d96b

Browse files
Catch NaNs in continFnPlot.
If we send those to `diagrams`, it can cause artifacts at the window boundary.
1 parent 279bb57 commit d94d96b

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

  • Graphics/Dynamic/Plot

Graphics/Dynamic/Plot/R2.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1422,7 +1422,9 @@ continFnPlot f = def
14221422
plot (GraphWindowSpecR2{..}) = curve `deepseq` mkPlot (trace curve)
14231423
where δx = (rBound - lBound) * 2 / fromIntegral xResolution
14241424
curve = [ (x ^& f x) | x<-[lBound, lBound+δx .. rBound] ]
1425-
trace (p:q:ps) = simpleLine p q <> trace (q:ps)
1425+
trace (p:q:ps) = (if not $ any (isNaN . (^._y)) [p, q]
1426+
then simpleLine p q else mempty
1427+
) <> trace (q:ps)
14261428
trace _ = mempty
14271429
pruneOutlyers = filter (not . isNaN)
14281430
l!%η = case length l of

0 commit comments

Comments
 (0)