diff --git a/collects/plot/plot2d/contour.rkt b/collects/plot/plot2d/contour.rkt index 09c072a1f6..2a0169906c 100644 --- a/collects/plot/plot2d/contour.rkt +++ b/collects/plot/plot2d/contour.rkt @@ -62,6 +62,9 @@ (define num (animated-samples samples)) (define sample (g (vector x-ivl y-ivl) (vector num num))) (match-define (2d-sample xs ys zss z-min z-max) sample) + + (unless (and z-min z-max) (return empty)) + (match-define (list (tick zs _ labels) ...) (contour-ticks (plot-z-ticks) z-min z-max levels #f)) ;; need to check this or in-cycle below does an infinite loop (I think it's an in-cycle bug) @@ -120,6 +123,9 @@ (define num (animated-samples samples)) (define sample (g (vector x-ivl y-ivl) (vector num num))) (match-define (2d-sample xs ys zss z-min z-max) sample) + + (unless (and z-min z-max) (return empty)) + (match-define (list (tick zs _ labels) ...) (contour-ticks (plot-z-ticks) z-min z-max levels #t)) (define-values (z-ivls ivl-labels) diff --git a/collects/plot/tests/plot2d-tests.rkt b/collects/plot/tests/plot2d-tests.rkt index e81ac52fe6..b8189c0e52 100644 --- a/collects/plot/tests/plot2d-tests.rkt +++ b/collects/plot/tests/plot2d-tests.rkt @@ -308,6 +308,10 @@ #:widths '(2) #:styles '(dot))) #:x-min -5 #:x-max 5 #:y-min -5 #:y-max 5)) +;; Both plots should be blank +(plot (contours f2 -5 0) #:x-min 1 #:x-max 3 #:y-min 1 #:y-max 3) +(plot (contour-intervals f2 -5 0) #:x-min 1 #:x-max 3 #:y-min 1 #:y-max 3) + (time (plot (contour-intervals f1 -5 5 -5 5 #:label "z"))) (time (plot (contour-intervals