Skip to content

Commit 829383e

Browse files
Neil Torontormculpepper
Neil Toronto
authored andcommitted
Fixed erroneous raised exception when plotting outside the bounds of
a 2D contour plot Please merge to 5.3.2 (cherry picked from commit ecd43f7)
1 parent 6708c38 commit 829383e

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

collects/plot/plot2d/contour.rkt

+6
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@
6262
(define num (animated-samples samples))
6363
(define sample (g (vector x-ivl y-ivl) (vector num num)))
6464
(match-define (2d-sample xs ys zss z-min z-max) sample)
65+
66+
(unless (and z-min z-max) (return empty))
67+
6568
(match-define (list (tick zs _ labels) ...) (contour-ticks (plot-z-ticks) z-min z-max levels #f))
6669

6770
;; need to check this or in-cycle below does an infinite loop (I think it's an in-cycle bug)
@@ -120,6 +123,9 @@
120123
(define num (animated-samples samples))
121124
(define sample (g (vector x-ivl y-ivl) (vector num num)))
122125
(match-define (2d-sample xs ys zss z-min z-max) sample)
126+
127+
(unless (and z-min z-max) (return empty))
128+
123129
(match-define (list (tick zs _ labels) ...) (contour-ticks (plot-z-ticks) z-min z-max levels #t))
124130

125131
(define-values (z-ivls ivl-labels)

collects/plot/tests/plot2d-tests.rkt

+4
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,10 @@
308308
#:widths '(2) #:styles '(dot)))
309309
#:x-min -5 #:x-max 5 #:y-min -5 #:y-max 5))
310310

311+
;; Both plots should be blank
312+
(plot (contours f2 -5 0) #:x-min 1 #:x-max 3 #:y-min 1 #:y-max 3)
313+
(plot (contour-intervals f2 -5 0) #:x-min 1 #:x-max 3 #:y-min 1 #:y-max 3)
314+
311315
(time (plot (contour-intervals f1 -5 5 -5 5 #:label "z")))
312316

313317
(time (plot (contour-intervals

0 commit comments

Comments
 (0)