diff --git a/pkgs/plot-pkgs/plot-lib/plot/private/plot2d/line.rkt b/pkgs/plot-pkgs/plot-lib/plot/private/plot2d/line.rkt index 7d238d20e1..b6d768d5fc 100644 --- a/pkgs/plot-pkgs/plot-lib/plot/private/plot2d/line.rkt +++ b/pkgs/plot-pkgs/plot-lib/plot/private/plot2d/line.rkt @@ -160,7 +160,9 @@ [ws (if ws (sequence->list ws) #f)]) (define n (length xs)) (define sd (stddev xs ws)) - (define h (* bw-adjust 1.06 sd (expt n -0.2))) + (define h (max 1e-308 + (* 1e-14 (apply max (map abs (filter rational? xs)))) + (* bw-adjust 1.06 sd (expt n -0.2)))) (define-values (f fx-min fx-max) (kde xs h ws)) (let ([x-min (if x-min x-min fx-min)] [x-max (if x-max x-max fx-max)])