Reduced the number of plot-specific contracts

This commit is contained in:
Neil Toronto 2011-10-07 18:05:54 -06:00
parent 644abe30fe
commit 50cf71466e
27 changed files with 189 additions and 198 deletions

View File

@ -6,14 +6,10 @@
(provide (all-defined-out))
;; ===================================================================================================
;; Conveniences
;; Convenience
(defcontract (real>=/c [r real?]) (and/c real? (>=/c r)))
(defcontract (integer>=/c [i integer?]) (and/c integer? (>=/c i)))
(defproc (treeof [contract (or/c contract? (any/c . -> . any/c))]) contract?
(or/c contract (listof (recursive-contract (treeof contract)))))
(defcontract (treeof [ct (or/c contract? (any/c . -> . any/c))])
(or/c ct (listof (recursive-contract (treeof ct)))))
;; ===================================================================================================
;; Plot-specific contracts
@ -28,18 +24,16 @@
(defcontract plot-color/c (or/c exact-integer? color/c))
(defcontract pen-style/c (one-of/c 'transparent 'solid 'dot 'long-dash
'short-dash 'dot-dash))
(defcontract plot-pen-style/c (or/c exact-integer?
(one-of/c 'transparent 'solid 'dot 'long-dash
'short-dash 'dot-dash)))
(defcontract plot-pen-style/c (or/c exact-integer? pen-style/c))
(defcontract plot-brush-style/c (or/c exact-integer?
(one-of/c 'transparent 'solid
'bdiagonal-hatch 'fdiagonal-hatch 'crossdiag-hatch
'horizontal-hatch 'vertical-hatch 'cross-hatch)))
(defcontract brush-style/c (one-of/c 'transparent 'solid
'bdiagonal-hatch 'fdiagonal-hatch 'crossdiag-hatch
'horizontal-hatch 'vertical-hatch 'cross-hatch))
(defcontract plot-brush-style/c (or/c exact-integer? brush-style/c))
(defcontract plot-font-size/c (real>=/c 0))
(defcontract plot-font-size/c (and/c real? (>=/c 0)))
(defcontract font-family/c (one-of/c 'default 'decorative 'roman 'script 'swiss
'modern 'symbol 'system))
@ -64,8 +58,8 @@
(defcontract plot-colors/c (or/c (listof plot-color/c)
((listof real?) . -> . (listof plot-color/c))))
(defcontract pen-widths/c (or/c (listof (real>=/c 0))
((listof real?) . -> . (listof (real>=/c 0)))))
(defcontract pen-widths/c (or/c (listof (and/c real? (>=/c 0)))
((listof real?) . -> . (listof (and/c real? (>=/c 0))))))
(defcontract plot-pen-styles/c (or/c (listof plot-pen-style/c)
((listof real?) . -> . (listof plot-pen-style/c))))

View File

@ -82,8 +82,8 @@
(160 160 160))) ; gray
(defproc (->pen-color [c plot-color/c]) (list/c real? real? real?)
(cond [(integer? c) (vector-ref pen-colors (remainder (abs c) 8))]
[else (->color c)]))
(cond [(exact-integer? c) (vector-ref pen-colors (remainder (abs c) 8))]
[else (->color c)]))
(define brush-colors
'#((255 255 255) ; white
@ -96,35 +96,35 @@
(212 212 212))) ; gray
(defproc (->brush-color [c plot-color/c]) (list/c real? real? real?)
(cond [(integer? c) (vector-ref brush-colors (remainder (abs c) 8))]
[else (->color c)]))
(cond [(exact-integer? c) (vector-ref brush-colors (remainder (abs c) 8))]
[else (->color c)]))
(defproc (->pen-style [s plot-pen-style/c]) pen-style/c
(cond [(integer? s) (case (remainder (abs s) 5)
[(0) 'solid]
[(1) 'dot]
[(2) 'long-dash]
[(3) 'short-dash]
[(4) 'dot-dash])]
[(symbol? s) s]
(defproc (->pen-style [s plot-pen-style/c]) symbol?
(cond [(exact-integer? s) (case (remainder (abs s) 5)
[(0) 'solid]
[(1) 'dot]
[(2) 'long-dash]
[(3) 'short-dash]
[(4) 'dot-dash])]
[(symbol? s) s]
[else (raise-type-error '->pen-style "symbol or integer" s)]))
(defproc (->brush-style [s plot-brush-style/c]) brush-style/c
(cond [(integer? s) (case (remainder (abs s) 7)
[(0) 'solid]
[(1) 'bdiagonal-hatch]
[(2) 'fdiagonal-hatch]
[(3) 'crossdiag-hatch]
[(4) 'horizontal-hatch]
[(5) 'vertical-hatch]
[(6) 'cross-hatch])]
[(symbol? s) s]
(defproc (->brush-style [s plot-brush-style/c]) symbol?
(cond [(exact-integer? s) (case (remainder (abs s) 7)
[(0) 'solid]
[(1) 'bdiagonal-hatch]
[(2) 'fdiagonal-hatch]
[(3) 'crossdiag-hatch]
[(4) 'horizontal-hatch]
[(5) 'vertical-hatch]
[(6) 'cross-hatch])]
[(symbol? s) s]
[else (raise-type-error '->brush-style "symbol or integer" s)]))
;; ===================================================================================================
;; Color functions
(defproc (color-seq [c1 color/c] [c2 color/c] [num (integer>=/c 0)]
(defproc (color-seq [c1 color/c] [c2 color/c] [num exact-nonnegative-integer?]
[#:start? start? boolean? #t]
[#:end? end? boolean? #t]) (listof (list/c real? real? real?))
(match-define (list r1 g1 b1) (->color c1))
@ -134,7 +134,7 @@
(define bs (linear-seq b1 b2 num #:start? start? #:end? end?))
(map list rs gs bs))
(defproc (color-seq* [colors (listof color/c)] [num (integer>=/c 0)]
(defproc (color-seq* [colors (listof color/c)] [num exact-nonnegative-integer?]
[#:start? start? boolean? #t]
[#:end? end? boolean? #t]) (listof (list/c real? real? real?))
(when (empty? colors) (raise-type-error 'color-seq* "nonempty (listof plot-color/c)" colors))

View File

@ -103,7 +103,7 @@
;; Return the shortest possible output string
(argmin string-length strs))]))
(defproc (->plot-label [a any/c] [digits exact-nonnegative-integer? 7]) string?
(defproc (->plot-label [a any/c] [digits exact-integer? 7]) string?
(let loop ([a a])
(cond [(string? a) a]
[(symbol? a) (symbol->string a)]

View File

@ -58,7 +58,7 @@
(for/list ([n (in-range num)])
(+ start (* n step))))
(defproc (linear-seq [start real?] [end real?] [num (integer>=/c 0)]
(defproc (linear-seq [start real?] [end real?] [num exact-nonnegative-integer?]
[#:start? start? boolean? #t]
[#:end? end? boolean? #t]) (listof real?)
(cond
@ -76,7 +76,7 @@
(build-linear-seq real-start step num)]))
(defproc (linear-seq* [points (listof real?)] [num (integer>=/c 0)]
(defproc (linear-seq* [points (listof real?)] [num exact-nonnegative-integer?]
[#:start? start? boolean? #t]
[#:end? end? boolean? #t]) (listof real?)
(let/ec return

View File

@ -16,8 +16,8 @@
;; Output
(defparam plot-width (integer>=/c 1) 400)
(defparam plot-height (integer>=/c 1) 400)
(defparam plot-width exact-positive-integer? 400)
(defparam plot-height exact-positive-integer? 400)
(defparam plot-new-window? boolean? #f)
(defparam plot-jpeg-quality (integer-in 0 100) 100)
(defparam plot-ps-interactive? boolean? #f)
@ -29,17 +29,17 @@
(defparam plot-background color plot-color/c 0)
(defparam plot-foreground-alpha alpha (real-in 0 1) 1)
(defparam plot-background-alpha alpha (real-in 0 1) 1)
(defparam plot-font-size size (real>=/c 0) 11)
(defparam plot-font-size size (and/c real? (>=/c 0)) 11)
(defparam plot-font-family family font-family/c 'roman)
(defparam plot-line-width width (real>=/c 0) 1)
(defparam plot-line-width width (and/c real? (>=/c 0)) 1)
(define (pen-gap) (* 2 (plot-line-width)))
(defparam plot-legend-anchor anchor anchor/c 'top-right)
(defparam plot-legend-box-alpha alpha (real-in 0 1) 2/3)
(defparam plot-tick-size (real>=/c 0) 10)
(defparam plot-tick-skip (integer>=/c 1) 2)
(defparam plot-tick-size (and/c real? (>=/c 0)) 10)
(defparam plot-tick-skip exact-positive-integer? 2)
(defparam plot-title (or/c string? #f) #f)
(defparam plot-x-label (or/c string? #f) "x axis")
@ -48,9 +48,9 @@
;; Lines
(defparam line-samples (integer>=/c 2) 500)
(defparam line-samples (and/c exact-integer? (>=/c 2)) 500)
(defparam line-color plot-color/c 1)
(defparam line-width (real>=/c 0) 1)
(defparam line-width (and/c real? (>=/c 0)) 1)
(defparam line-style plot-pen-style/c 'solid)
(defparam line-alpha (real-in 0 1) 1)
@ -59,10 +59,10 @@
(defparam interval-color plot-color/c 3)
(defparam interval-style plot-brush-style/c 'solid)
(defparam interval-line1-color plot-color/c 3)
(defparam interval-line1-width (real>=/c 0) 1)
(defparam interval-line1-width (and/c real? (>=/c 0)) 1)
(defparam interval-line1-style plot-pen-style/c 'solid)
(defparam interval-line2-color plot-color/c 3)
(defparam interval-line2-width (real>=/c 0) 1)
(defparam interval-line2-width (and/c real? (>=/c 0)) 1)
(defparam interval-line2-style plot-pen-style/c 'solid)
(defparam interval-alpha (real-in 0 1) 3/4)
@ -70,24 +70,24 @@
(defparam point-sym point-sym/c 'circle)
(defparam point-color plot-color/c 0)
(defparam point-size (real>=/c 0) 6)
(defparam point-line-width (real>=/c 0) 1)
(defparam point-size (and/c real? (>=/c 0)) 6)
(defparam point-line-width (and/c real? (>=/c 0)) 1)
(defparam point-alpha (real-in 0 1) 1)
;; Vector fields
(defparam vector-field-samples (integer>=/c 1) 20)
(defparam vector-field-samples exact-positive-integer? 20)
(defparam vector-field-color plot-color/c 1)
(defparam vector-field-line-width (real>=/c 0) 2/3)
(defparam vector-field-line-width (and/c real? (>=/c 0)) 2/3)
(defparam vector-field-line-style plot-pen-style/c 'solid)
(defparam vector-field-scale (or/c real? (one-of/c 'auto 'normalized)) 'auto)
(defparam vector-field-alpha (real-in 0 1) 1)
;; Error bars
(defparam error-bar-width (real>=/c 0) 6)
(defparam error-bar-width (and/c real? (>=/c 0)) 6)
(defparam error-bar-color plot-color/c 0)
(defparam error-bar-line-width (real>=/c 0) 1)
(defparam error-bar-line-width (and/c real? (>=/c 0)) 1)
(defparam error-bar-line-style plot-pen-style/c 'solid)
(defparam error-bar-alpha (real-in 0 1) 2/3)
@ -101,8 +101,8 @@
(color-seq* (list (->brush-color 5) (->brush-color 0) (->brush-color 1))
(sub1 (length zs))))
(defparam contour-samples (integer>=/c 2) 51)
(defparam contour-levels (or/c 'auto (integer>=/c 1) (listof real?)) 'auto)
(defparam contour-samples (and/c exact-integer? (>=/c 2)) 51)
(defparam contour-levels (or/c 'auto exact-positive-integer? (listof real?)) 'auto)
(defparam contour-colors plot-colors/c default-contour-colors)
(defparam contour-widths pen-widths/c '(1))
(defparam contour-styles plot-pen-styles/c '(solid long-dash))
@ -117,7 +117,7 @@
(defparam rectangle-color plot-color/c 3)
(defparam rectangle-style plot-brush-style/c 'solid)
(defparam rectangle-line-color plot-color/c 3)
(defparam rectangle-line-width (real>=/c 0) 1)
(defparam rectangle-line-width (and/c real? (>=/c 0)) 1)
(defparam rectangle-line-style plot-pen-style/c 'solid)
(defparam rectangle-alpha (real-in 0 1) 1)
(defparam discrete-histogram-gap (real-in 0 1) 1/8)
@ -128,13 +128,13 @@
(defparam y-axis-ticks? boolean? #t)
(defparam z-axis-ticks? boolean? #t)
(defparam polar-axes-number (integer>=/c 1) 12)
(defparam polar-axes-number exact-positive-integer? 12)
(defparam polar-axes-ticks? boolean? #t)
(defparam label-anchor anchor/c 'left)
(defparam label-angle real? 0)
(defparam label-alpha (real-in 0 1) 1)
(defparam label-point-size (real>=/c 0) 4)
(defparam label-point-size (and/c real? (>=/c 0)) 4)
;; Sampling
@ -147,7 +147,7 @@
;; General appearance
(defparam plot3d-samples (integer>=/c 2) 41)
(defparam plot3d-samples (and/c exact-integer? (>=/c 2)) 41)
(defparam plot3d-animating? boolean? #f)
(defparam plot3d-angle real? 30)
(defparam plot3d-altitude real? 60)
@ -155,7 +155,8 @@
(defparam plot3d-diffuse-light? boolean? #t)
(defparam plot3d-specular-light? boolean? #t)
(defproc (samples/animating? [samples (integer>=/c 2)]) (integer>=/c 2)
(defproc (samples/animating? [samples (and/c exact-integer? (>=/c 2))]
) (and/c exact-integer? (>=/c 2))
(cond [(plot3d-animating?) (max 2 (ceiling (* 1/4 samples)))]
[else samples]))
@ -164,7 +165,7 @@
(defparam surface-color plot-color/c 0)
(defparam surface-style plot-brush-style/c 'solid)
(defparam surface-line-color plot-color/c 0)
(defparam surface-line-width (real>=/c 0) 1/3)
(defparam surface-line-width (and/c real? (>=/c 0)) 1/3)
(defparam surface-line-style plot-pen-style/c 'solid)
(defparam surface-alpha (real-in 0 1) 1)
@ -184,7 +185,7 @@
(color-seq* (list (->pen-color 5) (->pen-color 0) (->pen-color 1))
(length zs)))
(defparam isosurface-levels (integer>=/c 1) 3)
(defparam isosurface-levels exact-positive-integer? 3)
(defparam isosurface-colors plot-colors/c default-isosurface-colors)
(defparam isosurface-line-colors plot-colors/c default-isosurface-line-colors)
(defparam isosurface-line-widths pen-widths/c '(1/3))
@ -193,4 +194,4 @@
;; Histograms
(defparam rectangle3d-line-width (real>=/c 0) 1/3)
(defparam rectangle3d-line-width (and/c real? (>=/c 0)) 1/3)

View File

@ -22,7 +22,7 @@
[(? mapped-function?) ((mapped-function-fmap f) xs)]
[_ (map f xs)]))
(defproc (nonlinear-seq [start real?] [end real?] [num (integer>=/c 0)]
(defproc (nonlinear-seq [start real?] [end real?] [num exact-nonnegative-integer?]
[transform (real? real? . -> . invertible-function?)]
[#:start? start? boolean? #t]
[#:end? end? boolean? #t]) (listof real?)

View File

@ -141,14 +141,14 @@
;; Functions that generate "plot data"
(defproc (points [vecs (listof (vectorof real?))]
[#:sym sym (or/c char? string? integer? symbol?) 'square]
[#:sym sym (or/c char? string? exact-integer? symbol?) 'square]
[#:color color plot-color? 'black]
) ((is-a?/c 2d-plot-area%) . -> . void?)
(renderer2d->plot-data (new.points (map (λ (v) (vector-take v 2)) vecs)
#:sym sym #:size 6 #:color color)))
(defproc (vector-field [f ((vector/c real? real?) . -> . (vector/c real? real?))]
[#:samples samples (integer>=/c 2) 20]
[#:samples samples (and/c exact-integer? (>=/c 2)) 20]
[#:width width exact-positive-integer? 1]
[#:color color plot-color? 'red]
[#:style style (one-of/c 'scaled 'normalized 'real) 'scaled]
@ -166,8 +166,8 @@
(renderer2d->plot-data (new.error-bars vecs #:color color #:alpha 1 #:width 4)))
(defproc (line [f (real? . -> . (or/c real? (vector/c real? real?)))]
[#:samples samples (integer>=/c 2) 150]
[#:width width (real>=/c 0) 1]
[#:samples samples (and/c exact-integer? (>=/c 2)) 150]
[#:width width (and/c real? (>=/c 0)) 1]
[#:color color plot-color/c 'red]
[#:mode mode (one-of/c 'standard 'parametric) 'standard]
[#:mapping mapping (one-of/c 'cartesian 'polar) 'cartesian]
@ -177,21 +177,21 @@
(defproc (contour [f (real? real? . -> . real?)]
[#:samples samples exact-nonnegative-integer? 50]
[#:width width (real>=/c 0) 1]
[#:width width (and/c real? (>=/c 0)) 1]
[#:color color plot-color/c 'black]
[#:levels levels (or/c (integer>=/c 2) (listof real?)) 10]
[#:levels levels (or/c (and/c exact-integer? (>=/c 2)) (listof real?)) 10]
) ((is-a?/c 2d-plot-area%) . -> . void?)
(renderer2d->plot-data (contour-renderer f samples width color levels)))
(defproc (shade [f (real? real? . -> . real?)]
[#:samples samples (integer>=/c 2) 50]
[#:levels levels (or/c (integer>=/c 2) (listof real?)) 10]
[#:samples samples (and/c exact-integer? (>=/c 2)) 50]
[#:levels levels (or/c (and/c exact-integer? (>=/c 2)) (listof real?)) 10]
) ((is-a?/c 2d-plot-area%) . -> . void?)
(renderer2d->plot-data (shade-renderer f samples levels)))
(defproc (surface [f (real? real? . -> . real?)]
[#:samples samples (integer>=/c 2) 50]
[#:width width (real>=/c 0) 1]
[#:samples samples (and/c exact-integer? (>=/c 2)) 50]
[#:width width (and/c real? (>=/c 0)) 1]
[#:color color plot-color/c 'black]
) ((is-a?/c 3d-plot-area%) . -> . void?)
(renderer3d->plot-data (surface-renderer f samples width color)))

View File

@ -29,8 +29,8 @@
(apply list renderers))
(defproc (line [f (real? . -> . (or/c real? (vector/c real? real?)))]
[#:samples samples (integer>=/c 2) 150]
[#:width width (real>=/c 0) 1]
[#:samples samples (and/c exact-integer? (>=/c 2)) 150]
[#:width width (and/c real? (>=/c 0)) 1]
[#:color color plot-color/c 'red]
[#:mode mode (one-of/c 'standard 'parametric) 'standard]
[#:mapping mapping (one-of/c 'cartesian 'polar) 'cartesian]
@ -40,24 +40,24 @@
(line-renderer f samples width color mode mapping t-min t-max))
(defproc (contour [f (real? real? . -> . real?)]
[#:samples samples (integer>=/c 2) 50]
[#:width width (real>=/c 0) 1]
[#:samples samples (and/c exact-integer? (>=/c 2)) 50]
[#:width width (and/c real? (>=/c 0)) 1]
[#:color color plot-color/c 'black]
[#:levels levels (or/c (integer>=/c 2) (listof real?)) 10]
[#:levels levels (or/c (and/c exact-integer? (>=/c 2)) (listof real?)) 10]
) renderer2d?
(deprecation-warning "contour" "contours")
(contour-renderer f samples width color levels))
(defproc (shade [f (real? real? . -> . real?)]
[#:samples samples (integer>=/c 2) 50]
[#:levels levels (or/c (integer>=/c 2) (listof real?)) 10]
[#:samples samples (and/c exact-integer? (>=/c 2)) 50]
[#:levels levels (or/c (and/c exact-integer? (>=/c 2)) (listof real?)) 10]
) renderer2d?
(deprecation-warning "shade" "contour-intervals")
(shade-renderer f samples levels))
(defproc (surface [f (real? real? . -> . real?)]
[#:samples samples (integer>=/c 2) 50]
[#:width width (real>=/c 0) 1]
[#:samples samples (and/c exact-integer? (>=/c 2)) 50]
[#:width width (and/c real? (>=/c 0)) 1]
[#:color color plot-color/c 'black]
) renderer3d?
(deprecation-warning "surface" "surface3d")

View File

@ -31,14 +31,14 @@
#:samples samples #:width width #:color color)])]))
(define (contour-renderer f samples width color levels)
(contours f #:samples samples #:levels (if (integer? levels) (sub1 levels) levels)
(contours f #:samples samples #:levels (if (exact-integer? levels) (sub1 levels) levels)
#:colors (list color) #:widths (list width) #:styles '(solid)))
(define (shade-fill-colors zs)
(color-seq* '((0 0 255) (255 255 255) (255 0 0)) (sub1 (length zs))))
(define (shade-renderer f samples levels)
(contour-intervals f #:samples samples #:levels (if (integer? levels) (sub1 levels) levels)
(contour-intervals f #:samples samples #:levels (if (exact-integer? levels) (sub1 levels) levels)
#:colors shade-fill-colors #:contour-styles '(transparent)))
(define (surface-renderer f samples width color)

View File

@ -71,8 +71,8 @@
[f (real? real? . -> . real?)]
[x-min (or/c real? #f) #f] [x-max (or/c real? #f) #f]
[y-min (or/c real? #f) #f] [y-max (or/c real? #f) #f]
[#:levels levels (or/c 'auto (integer>=/c 1) (listof real?)) (contour-levels)]
[#:samples samples (integer>=/c 2) (contour-samples)]
[#:levels levels (or/c 'auto exact-positive-integer? (listof real?)) (contour-levels)]
[#:samples samples (and/c exact-integer? (>=/c 2)) (contour-samples)]
[#:colors colors plot-colors/c (contour-colors)]
[#:widths widths pen-widths/c (contour-widths)]
[#:styles styles plot-pen-styles/c (contour-styles)]
@ -171,8 +171,8 @@
[f (real? real? . -> . real?)]
[x-min (or/c real? #f) #f] [x-max (or/c real? #f) #f]
[y-min (or/c real? #f) #f] [y-max (or/c real? #f) #f]
[#:levels levels (or/c 'auto (integer>=/c 1) (listof real?)) (contour-levels)]
[#:samples samples (integer>=/c 2) (contour-samples)]
[#:levels levels (or/c 'auto exact-positive-integer? (listof real?)) (contour-levels)]
[#:samples samples (and/c exact-integer? (>=/c 2)) (contour-samples)]
[#:colors colors plot-colors/c (contour-interval-colors)]
[#:styles styles plot-brush-styles/c (contour-interval-styles)]
[#:contour-colors contour-colors plot-colors/c (contour-colors)]

View File

@ -107,7 +107,7 @@
empty)
(defproc (polar-axes [#:number num (integer>=/c 1) (polar-axes-number)]
(defproc (polar-axes [#:number num exact-positive-integer? (polar-axes-number)]
[#:ticks? ticks? boolean? (polar-axes-ticks?)]
) renderer2d?
(renderer2d (polar-axes-render-proc num ticks?)
@ -182,10 +182,10 @@
(defproc (point-label
[v (vector/c real? real?)] [label (or/c string? #f) #f]
[#:color color plot-color/c (plot-foreground)]
[#:size size (real>=/c 0) (plot-font-size)]
[#:size size (and/c real? (>=/c 0)) (plot-font-size)]
[#:anchor anchor anchor/c (label-anchor)]
[#:angle angle real? (label-angle)]
[#:point-size point-size (real>=/c 0) (label-point-size)]
[#:point-size point-size (and/c real? (>=/c 0)) (label-point-size)]
[#:alpha alpha (real-in 0 1) (label-alpha)]
) renderer2d?
(match-define (vector x y) v)
@ -198,10 +198,10 @@
[f (real? . -> . (vector/c real? real?))]
[t real?] [label (or/c string? #f) #f]
[#:color color plot-color/c (plot-foreground)]
[#:size size (real>=/c 0) (plot-font-size)]
[#:size size (and/c real? (>=/c 0)) (plot-font-size)]
[#:anchor anchor anchor/c (label-anchor)]
[#:angle angle real? (label-angle)]
[#:point-size point-size (real>=/c 0) (label-point-size)]
[#:point-size point-size (and/c real? (>=/c 0)) (label-point-size)]
[#:alpha alpha (real-in 0 1) (label-alpha)]
) renderer2d?
(point-label (match f
@ -213,10 +213,10 @@
(defproc (polar-label
[f (real? . -> . real?)] [θ real?] [label (or/c string? #f) #f]
[#:color color plot-color/c (plot-foreground)]
[#:size size (real>=/c 0) (plot-font-size)]
[#:size size (and/c real? (>=/c 0)) (plot-font-size)]
[#:anchor anchor anchor/c (label-anchor)]
[#:angle angle real? (label-angle)]
[#:point-size point-size (real>=/c 0) (label-point-size)]
[#:point-size point-size (and/c real? (>=/c 0)) (label-point-size)]
[#:alpha alpha (real-in 0 1) (label-alpha)]
) renderer2d?
(point-label (polar->cartesian θ (f θ)) label
@ -226,10 +226,10 @@
(defproc (function-label
[f (real? . -> . real?)] [x real?] [label (or/c string? #f) #f]
[#:color color plot-color/c (plot-foreground)]
[#:size size (real>=/c 0) (plot-font-size)]
[#:size size (and/c real? (>=/c 0)) (plot-font-size)]
[#:anchor anchor anchor/c (label-anchor)]
[#:angle angle real? (label-angle)]
[#:point-size point-size (real>=/c 0) (label-point-size)]
[#:point-size point-size (and/c real? (>=/c 0)) (label-point-size)]
[#:alpha alpha (real-in 0 1) (label-alpha)]
) renderer2d?
(point-label (vector x (f x)) label
@ -239,10 +239,10 @@
(defproc (inverse-label
[f (real? . -> . real?)] [y real?] [label (or/c string? #f) #f]
[#:color color plot-color/c (plot-foreground)]
[#:size size (real>=/c 0) (plot-font-size)]
[#:size size (and/c real? (>=/c 0)) (plot-font-size)]
[#:anchor anchor anchor/c (label-anchor)]
[#:angle angle real? (label-angle)]
[#:point-size point-size (real>=/c 0) (label-point-size)]
[#:point-size point-size (and/c real? (>=/c 0)) (label-point-size)]
[#:alpha alpha (real-in 0 1) (label-alpha)]
) renderer2d?
(point-label (vector (f y) y) label

View File

@ -48,10 +48,10 @@
[#:color color plot-color/c (interval-color)]
[#:style style plot-brush-style/c (interval-style)]
[#:line1-color line1-color plot-color/c (interval-line1-color)]
[#:line1-width line1-width (real>=/c 0) (interval-line1-width)]
[#:line1-width line1-width (and/c real? (>=/c 0)) (interval-line1-width)]
[#:line1-style line1-style plot-pen-style/c (interval-line1-style)]
[#:line2-color line2-color plot-color/c (interval-line2-color)]
[#:line2-width line2-width (real>=/c 0) (interval-line2-width)]
[#:line2-width line2-width (and/c real? (>=/c 0)) (interval-line2-width)]
[#:line2-style line2-style plot-pen-style/c (interval-line2-style)]
[#:alpha alpha (real-in 0 1) (interval-alpha)]
[#:label label (or/c string? #f) #f]
@ -79,14 +79,14 @@
[t-min real?] [t-max real?]
[#:x-min x-min (or/c real? #f) #f] [#:x-max x-max (or/c real? #f) #f]
[#:y-min y-min (or/c real? #f) #f] [#:y-max y-max (or/c real? #f) #f]
[#:samples samples (integer>=/c 2) (line-samples)]
[#:samples samples (and/c exact-integer? (>=/c 2)) (line-samples)]
[#:color color plot-color/c (interval-color)]
[#:style style plot-brush-style/c (interval-style)]
[#:line1-color line1-color plot-color/c (interval-line1-color)]
[#:line1-width line1-width (real>=/c 0) (interval-line1-width)]
[#:line1-width line1-width (and/c real? (>=/c 0)) (interval-line1-width)]
[#:line1-style line1-style plot-pen-style/c (interval-line1-style)]
[#:line2-color line2-color plot-color/c (interval-line2-color)]
[#:line2-width line2-width (real>=/c 0) (interval-line2-width)]
[#:line2-width line2-width (and/c real? (>=/c 0)) (interval-line2-width)]
[#:line2-style line2-style plot-pen-style/c (interval-line2-style)]
[#:alpha alpha (real-in 0 1) (interval-alpha)]
[#:label label (or/c string? #f) #f]
@ -105,14 +105,14 @@
[θ-min real? 0] [θ-max real? (* 2 pi)]
[#:x-min x-min (or/c real? #f) #f] [#:x-max x-max (or/c real? #f) #f]
[#:y-min y-min (or/c real? #f) #f] [#:y-max y-max (or/c real? #f) #f]
[#:samples samples (integer>=/c 2) (line-samples)]
[#:samples samples (and/c exact-integer? (>=/c 2)) (line-samples)]
[#:color color plot-color/c (interval-color)]
[#:style style plot-brush-style/c (interval-style)]
[#:line1-color line1-color plot-color/c (interval-line1-color)]
[#:line1-width line1-width (real>=/c 0) (interval-line1-width)]
[#:line1-width line1-width (and/c real? (>=/c 0)) (interval-line1-width)]
[#:line1-style line1-style plot-pen-style/c (interval-line1-style)]
[#:line2-color line2-color plot-color/c (interval-line2-color)]
[#:line2-width line2-width (real>=/c 0) (interval-line2-width)]
[#:line2-width line2-width (and/c real? (>=/c 0)) (interval-line2-width)]
[#:line2-style line2-style plot-pen-style/c (interval-line2-style)]
[#:alpha alpha (real-in 0 1) (interval-alpha)]
[#:label label (or/c string? #f) #f]
@ -151,14 +151,14 @@
[f1 (real? . -> . real?)] [f2 (real? . -> . real?)]
[x-min (or/c real? #f) #f] [x-max (or/c real? #f) #f]
[#:y-min y-min (or/c real? #f) #f] [#:y-max y-max (or/c real? #f) #f]
[#:samples samples (integer>=/c 2) (line-samples)]
[#:samples samples (and/c exact-integer? (>=/c 2)) (line-samples)]
[#:color color plot-color/c (interval-color)]
[#:style style plot-brush-style/c (interval-style)]
[#:line1-color line1-color plot-color/c (interval-line1-color)]
[#:line1-width line1-width (real>=/c 0) (interval-line1-width)]
[#:line1-width line1-width (and/c real? (>=/c 0)) (interval-line1-width)]
[#:line1-style line1-style plot-pen-style/c (interval-line1-style)]
[#:line2-color line2-color plot-color/c (interval-line2-color)]
[#:line2-width line2-width (real>=/c 0) (interval-line2-width)]
[#:line2-width line2-width (and/c real? (>=/c 0)) (interval-line2-width)]
[#:line2-style line2-style plot-pen-style/c (interval-line2-style)]
[#:alpha alpha (real-in 0 1) (interval-alpha)]
[#:label label (or/c string? #f) #f]
@ -198,14 +198,14 @@
[f1 (real? . -> . real?)] [f2 (real? . -> . real?)]
[y-min (or/c real? #f) #f] [y-max (or/c real? #f) #f]
[#:x-min x-min (or/c real? #f) #f] [#:x-max x-max (or/c real? #f) #f]
[#:samples samples (integer>=/c 2) (line-samples)]
[#:samples samples (and/c exact-integer? (>=/c 2)) (line-samples)]
[#:color color plot-color/c (interval-color)]
[#:style style plot-brush-style/c (interval-style)]
[#:line1-color line1-color plot-color/c (interval-line1-color)]
[#:line1-width line1-width (real>=/c 0) (interval-line1-width)]
[#:line1-width line1-width (and/c real? (>=/c 0)) (interval-line1-width)]
[#:line1-style line1-style plot-pen-style/c (interval-line1-style)]
[#:line2-color line2-color plot-color/c (interval-line2-color)]
[#:line2-width line2-width (real>=/c 0) (interval-line2-width)]
[#:line2-width line2-width (and/c real? (>=/c 0)) (interval-line2-width)]
[#:line2-style line2-style plot-pen-style/c (interval-line2-style)]
[#:alpha alpha (real-in 0 1) (interval-alpha)]
[#:label label (or/c string? #f) #f]

View File

@ -134,9 +134,9 @@
(defproc (density [xs (listof real?)] [bw-adjust real? 1]
[#:x-min x-min (or/c real? #f) #f] [#:x-max x-max (or/c real? #f) #f]
[#:y-min y-min (or/c real? #f) #f] [#:y-max y-max (or/c real? #f) #f]
[#:samples samples (integer>=/c 2) (line-samples)]
[#:samples samples (and/c exact-integer? (>=/c 2)) (line-samples)]
[#:color color plot-color/c (line-color)]
[#:width width (real>=/c 0) (line-width)]
[#:width width (and/c real? (>=/c 0)) (line-width)]
[#:style style plot-pen-style/c (line-style)]
[#:alpha alpha (real-in 0 1) (line-alpha)]
[#:label label (or/c string? #f) #f]

View File

@ -31,7 +31,7 @@
[#:x-min x-min (or/c real? #f) #f] [#:x-max x-max (or/c real? #f) #f]
[#:y-min y-min (or/c real? #f) #f] [#:y-max y-max (or/c real? #f) #f]
[#:color color plot-color/c (line-color)]
[#:width width (real>=/c 0) (line-width)]
[#:width width (and/c real? (>=/c 0)) (line-width)]
[#:style style plot-pen-style/c (line-style)]
[#:alpha alpha (real-in 0 1) (line-alpha)]
[#:label label (or/c string? #f) #f]
@ -53,9 +53,9 @@
[t-min real?] [t-max real?]
[#:x-min x-min (or/c real? #f) #f] [#:x-max x-max (or/c real? #f) #f]
[#:y-min y-min (or/c real? #f) #f] [#:y-max y-max (or/c real? #f) #f]
[#:samples samples (integer>=/c 2) (line-samples)]
[#:samples samples (and/c exact-integer? (>=/c 2)) (line-samples)]
[#:color color plot-color/c (line-color)]
[#:width width (real>=/c 0) (line-width)]
[#:width width (and/c real? (>=/c 0)) (line-width)]
[#:style style plot-pen-style/c (line-style)]
[#:alpha alpha (real-in 0 1) (line-alpha)]
[#:label label (or/c string? #f) #f]
@ -69,9 +69,9 @@
[θ-min real? 0] [θ-max real? (* 2 pi)]
[#:x-min x-min (or/c real? #f) #f] [#:x-max x-max (or/c real? #f) #f]
[#:y-min y-min (or/c real? #f) #f] [#:y-max y-max (or/c real? #f) #f]
[#:samples samples (integer>=/c 2) (line-samples)]
[#:samples samples (and/c exact-integer? (>=/c 2)) (line-samples)]
[#:color color plot-color/c (line-color)]
[#:width width (real>=/c 0) (line-width)]
[#:width width (and/c real? (>=/c 0)) (line-width)]
[#:style style plot-pen-style/c (line-style)]
[#:alpha alpha (real-in 0 1) (line-alpha)]
[#:label label (or/c string? #f) #f]
@ -99,9 +99,9 @@
(defproc (function [f (real? . -> . real?)]
[x-min (or/c real? #f) #f] [x-max (or/c real? #f) #f]
[#:y-min y-min (or/c real? #f) #f] [#:y-max y-max (or/c real? #f) #f]
[#:samples samples (integer>=/c 2) (line-samples)]
[#:samples samples (and/c exact-integer? (>=/c 2)) (line-samples)]
[#:color color plot-color/c (line-color)]
[#:width width (real>=/c 0) (line-width)]
[#:width width (and/c real? (>=/c 0)) (line-width)]
[#:style style plot-pen-style/c (line-style)]
[#:alpha alpha (real-in 0 1) (line-alpha)]
[#:label label (or/c string? #f) #f]
@ -130,9 +130,9 @@
(defproc (inverse [f (real? . -> . real?)]
[y-min (or/c real? #f) #f] [y-max (or/c real? #f) #f]
[#:x-min x-min (or/c real? #f) #f] [#:x-max x-max (or/c real? #f) #f]
[#:samples samples (integer>=/c 2) (line-samples)]
[#:samples samples (and/c exact-integer? (>=/c 2)) (line-samples)]
[#:color color plot-color/c (line-color)]
[#:width width (real>=/c 0) (line-width)]
[#:width width (and/c real? (>=/c 0)) (line-width)]
[#:style style plot-pen-style/c (line-style)]
[#:alpha alpha (real-in 0 1) (line-alpha)]
[#:label label (or/c string? #f) #f]

View File

@ -30,7 +30,7 @@
(defproc (plot/dc [renderer-tree (treeof renderer2d?)]
[dc (is-a?/c dc<%>)]
[x real?] [y real?] [width (real>=/c 0)] [height (real>=/c 0)]
[x real?] [y real?] [width (and/c real? (>=/c 0))] [height (and/c real? (>=/c 0))]
[#:x-min x-min (or/c real? #f) #f]
[#:x-max x-max (or/c real? #f) #f]
[#:y-min y-min (or/c real? #f) #f]
@ -95,8 +95,8 @@
(defproc (plot-bitmap [renderer-tree (treeof renderer2d?)]
[#:x-min x-min (or/c real? #f) #f] [#:x-max x-max (or/c real? #f) #f]
[#:y-min y-min (or/c real? #f) #f] [#:y-max y-max (or/c real? #f) #f]
[#:width width (integer>=/c 1) (plot-width)]
[#:height height (integer>=/c 1) (plot-height)]
[#:width width exact-positive-integer? (plot-width)]
[#:height height exact-positive-integer? (plot-height)]
[#:title title (or/c string? #f) (plot-title)]
[#:x-label x-label (or/c string? #f) (plot-x-label)]
[#:y-label y-label (or/c string? #f) (plot-y-label)]
@ -112,8 +112,8 @@
(defproc (plot-pict [renderer-tree (treeof renderer2d?)]
[#:x-min x-min (or/c real? #f) #f] [#:x-max x-max (or/c real? #f) #f]
[#:y-min y-min (or/c real? #f) #f] [#:y-max y-max (or/c real? #f) #f]
[#:width width (integer>=/c 1) (plot-width)]
[#:height height (integer>=/c 1) (plot-height)]
[#:width width exact-positive-integer? (plot-width)]
[#:height height exact-positive-integer? (plot-height)]
[#:title title (or/c string? #f) (plot-title)]
[#:x-label x-label (or/c string? #f) (plot-x-label)]
[#:y-label y-label (or/c string? #f) (plot-y-label)]
@ -154,8 +154,8 @@
(defproc (plot-snip [renderer-tree (treeof renderer2d?)]
[#:x-min x-min (or/c real? #f) #f] [#:x-max x-max (or/c real? #f) #f]
[#:y-min y-min (or/c real? #f) #f] [#:y-max y-max (or/c real? #f) #f]
[#:width width (integer>=/c 1) (plot-width)]
[#:height height (integer>=/c 1) (plot-height)]
[#:width width exact-positive-integer? (plot-width)]
[#:height height exact-positive-integer? (plot-height)]
[#:title title (or/c string? #f) (plot-title)]
[#:x-label x-label (or/c string? #f) (plot-x-label)]
[#:y-label y-label (or/c string? #f) (plot-y-label)]
@ -172,8 +172,8 @@
(defproc (plot-frame [renderer-tree (treeof renderer2d?)]
[#:x-min x-min (or/c real? #f) #f] [#:x-max x-max (or/c real? #f) #f]
[#:y-min y-min (or/c real? #f) #f] [#:y-max y-max (or/c real? #f) #f]
[#:width width (integer>=/c 1) (plot-width)]
[#:height height (integer>=/c 1) (plot-height)]
[#:width width exact-positive-integer? (plot-width)]
[#:height height exact-positive-integer? (plot-height)]
[#:title title (or/c string? #f) (plot-title)]
[#:x-label x-label (or/c string? #f) (plot-x-label)]
[#:y-label y-label (or/c string? #f) (plot-y-label)]
@ -192,8 +192,8 @@
[kind (one-of/c 'auto 'png 'jpeg 'xmb 'xpm 'bmp 'ps 'pdf 'svg) 'auto]
[#:x-min x-min (or/c real? #f) #f] [#:x-max x-max (or/c real? #f) #f]
[#:y-min y-min (or/c real? #f) #f] [#:y-max y-max (or/c real? #f) #f]
[#:width width (integer>=/c 1) (plot-width)]
[#:height height (integer>=/c 1) (plot-height)]
[#:width width exact-positive-integer? (plot-width)]
[#:height height exact-positive-integer? (plot-height)]
[#:title title (or/c string? #f) (plot-title)]
[#:x-label x-label (or/c string? #f) (plot-x-label)]
[#:y-label y-label (or/c string? #f) (plot-y-label)]
@ -233,8 +233,8 @@
(defproc (plot [renderer-tree (treeof renderer2d?)]
[#:x-min x-min (or/c real? #f) #f] [#:x-max x-max (or/c real? #f) #f]
[#:y-min y-min (or/c real? #f) #f] [#:y-max y-max (or/c real? #f) #f]
[#:width width (integer>=/c 1) (plot-width)]
[#:height height (integer>=/c 1) (plot-height)]
[#:width width exact-positive-integer? (plot-width)]
[#:height height exact-positive-integer? (plot-height)]
[#:title title (or/c string? #f) (plot-title)]
[#:x-label x-label (or/c string? #f) (plot-x-label)]
[#:y-label y-label (or/c string? #f) (plot-y-label)]

View File

@ -30,8 +30,8 @@
[#:y-min y-min (or/c real? #f) #f] [#:y-max y-max (or/c real? #f) #f]
[#:sym sym point-sym/c (point-sym)]
[#:color color plot-color/c (point-color)]
[#:size size (real>=/c 0) (point-size)]
[#:line-width line-width (real>=/c 0) (point-line-width)]
[#:size size (and/c real? (>=/c 0)) (point-size)]
[#:line-width line-width (and/c real? (>=/c 0)) (point-line-width)]
[#:alpha alpha (real-in 0 1) (point-alpha)]
[#:label label (or/c string? #f) #f]
) renderer2d?
@ -97,10 +97,10 @@
((vector/c real? real?) . -> . (vector/c real? real?)))]
[x-min (or/c real? #f) #f] [x-max (or/c real? #f) #f]
[y-min (or/c real? #f) #f] [y-max (or/c real? #f) #f]
[#:samples samples (integer>=/c 1) (vector-field-samples)]
[#:samples samples exact-positive-integer? (vector-field-samples)]
[#:scale scale (or/c real? (one-of/c 'auto 'normalized)) (vector-field-scale)]
[#:color color plot-color/c (vector-field-color)]
[#:line-width line-width (real>=/c 0) (vector-field-line-width)]
[#:line-width line-width (and/c real? (>=/c 0)) (vector-field-line-width)]
[#:line-style line-style plot-pen-style/c (vector-field-line-style)]
[#:alpha alpha (real-in 0 1) (vector-field-alpha)]
[#:label label (or/c string? #f) #f]
@ -158,9 +158,9 @@
[#:x-min x-min (or/c real? #f) #f] [#:x-max x-max (or/c real? #f) #f]
[#:y-min y-min (or/c real? #f) #f] [#:y-max y-max (or/c real? #f) #f]
[#:color color plot-color/c (error-bar-color)]
[#:line-width line-width (real>=/c 0) (error-bar-line-width)]
[#:line-style line-style (real>=/c 0) (error-bar-line-style)]
[#:width width (real>=/c 0) (error-bar-width)]
[#:line-width line-width (and/c real? (>=/c 0)) (error-bar-line-width)]
[#:line-style line-style (and/c real? (>=/c 0)) (error-bar-line-style)]
[#:width width (and/c real? (>=/c 0)) (error-bar-width)]
[#:alpha alpha (real-in 0 1) (error-bar-alpha)]
) renderer2d?
(let ([bars (filter vregular? bars)])

View File

@ -36,7 +36,7 @@
[#:color color plot-color/c (rectangle-color)]
[#:style style plot-brush-style/c (rectangle-style)]
[#:line-color line-color plot-color/c (rectangle-line-color)]
[#:line-width line-width (real>=/c 0) (rectangle-line-width)]
[#:line-width line-width (and/c real? (>=/c 0)) (rectangle-line-width)]
[#:line-style line-style plot-pen-style/c (rectangle-line-style)]
[#:alpha alpha (real-in 0 1) (rectangle-alpha)]
[#:label label (or/c string? #f) #f]
@ -66,11 +66,11 @@
[bin-bounds (listof real?)]
[#:x-min x-min (or/c real? #f) #f] [#:x-max x-max (or/c real? #f) #f]
[#:y-min y-min (or/c real? #f) 0] [#:y-max y-max (or/c real? #f) #f]
[#:samples samples (integer>=/c 2) (line-samples)]
[#:samples samples (and/c exact-integer? (>=/c 2)) (line-samples)]
[#:color color plot-color/c (rectangle-color)]
[#:style style plot-brush-style/c (rectangle-style)]
[#:line-color line-color plot-color/c (rectangle-line-color)]
[#:line-width line-width (real>=/c 0) (rectangle-line-width)]
[#:line-width line-width (and/c real? (>=/c 0)) (rectangle-line-width)]
[#:line-style line-style plot-pen-style/c (rectangle-line-style)]
[#:alpha alpha (real-in 0 1) (rectangle-alpha)]
[#:label label (or/c string? #f) #f]
@ -112,7 +112,7 @@
[#:color color plot-color/c (rectangle-color)]
[#:style style plot-brush-style/c (rectangle-style)]
[#:line-color line-color plot-color/c (rectangle-line-color)]
[#:line-width line-width (real>=/c 0) (rectangle-line-width)]
[#:line-width line-width (and/c real? (>=/c 0)) (rectangle-line-width)]
[#:line-style line-style plot-pen-style/c (rectangle-line-style)]
[#:alpha alpha (real-in 0 1) (rectangle-alpha)]
[#:label label (or/c string? #f) #f]

View File

@ -69,8 +69,8 @@
[x-min (or/c real? #f) #f] [x-max (or/c real? #f) #f]
[y-min (or/c real? #f) #f] [y-max (or/c real? #f) #f]
[#:z-min z-min (or/c real? #f) #f] [#:z-max z-max (or/c real? #f) #f]
[#:levels levels (or/c 'auto (integer>=/c 1) (listof real?)) (contour-levels)]
[#:samples samples (integer>=/c 2) (plot3d-samples)]
[#:levels levels (or/c 'auto exact-positive-integer? (listof real?)) (contour-levels)]
[#:samples samples (and/c exact-integer? (>=/c 2)) (plot3d-samples)]
[#:colors colors plot-colors/c (contour-colors)]
[#:widths widths pen-widths/c (contour-widths)]
[#:styles styles plot-pen-styles/c (contour-styles)]
@ -149,8 +149,8 @@
[x-min (or/c real? #f) #f] [x-max (or/c real? #f) #f]
[y-min (or/c real? #f) #f] [y-max (or/c real? #f) #f]
[#:z-min z-min (or/c real? #f) #f] [#:z-max z-max (or/c real? #f) #f]
[#:levels levels (or/c 'auto (integer>=/c 1) (listof real?)) (contour-levels)]
[#:samples samples (integer>=/c 2) (plot3d-samples)]
[#:levels levels (or/c 'auto exact-positive-integer? (listof real?)) (contour-levels)]
[#:samples samples (and/c exact-integer? (>=/c 2)) (plot3d-samples)]
[#:colors colors plot-colors/c (contour-interval-colors)]
[#:line-colors line-colors plot-colors/c (contour-interval-line-colors)]
[#:line-widths line-widths pen-widths/c (contour-interval-line-widths)]

View File

@ -74,10 +74,10 @@
[x-min (or/c real? #f) #f] [x-max (or/c real? #f) #f]
[y-min (or/c real? #f) #f] [y-max (or/c real? #f) #f]
[z-min (or/c real? #f) #f] [z-max (or/c real? #f) #f]
[#:samples samples (integer>=/c 2) (plot3d-samples)]
[#:samples samples (and/c exact-integer? (>=/c 2)) (plot3d-samples)]
[#:color color plot-color/c (surface-color)]
[#:line-color line-color plot-color/c (surface-line-color)]
[#:line-width line-width (real>=/c 0) (surface-line-width)]
[#:line-width line-width (and/c real? (>=/c 0)) (surface-line-width)]
[#:line-style line-style plot-pen-style/c (surface-line-style)]
[#:alpha alpha (real-in 0 1) (surface-alpha)]
[#:label label (or/c string? #f) #f]
@ -167,8 +167,8 @@
[y-min (or/c real? #f) #f] [y-max (or/c real? #f) #f]
[z-min (or/c real? #f) #f] [z-max (or/c real? #f) #f]
[#:d-min d-min (or/c real? #f) #f] [#:d-max d-max (or/c real? #f) #f]
[#:levels levels (integer>=/c 1) (isosurface-levels)]
[#:samples samples (integer>=/c 2) (plot3d-samples)]
[#:levels levels exact-positive-integer? (isosurface-levels)]
[#:samples samples (and/c exact-integer? (>=/c 2)) (plot3d-samples)]
[#:colors colors plot-colors/c (isosurface-colors)]
[#:line-colors line-colors plot-colors/c (isosurface-line-colors)]
[#:line-widths line-widths pen-widths/c (isosurface-line-widths)]
@ -253,10 +253,10 @@
[#:x-min x-min (or/c real? #f) #f] [#:x-max x-max (or/c real? #f) #f]
[#:y-min y-min (or/c real? #f) #f] [#:y-max y-max (or/c real? #f) #f]
[#:z-min z-min (or/c real? #f) #f] [#:z-max z-max (or/c real? #f) #f]
[#:samples samples (integer>=/c 2) (plot3d-samples)]
[#:samples samples (and/c exact-integer? (>=/c 2)) (plot3d-samples)]
[#:color color plot-color/c (surface-color)]
[#:line-color line-color plot-color/c (surface-line-color)]
[#:line-width line-width (real>=/c 0) (surface-line-width)]
[#:line-width line-width (and/c real? (>=/c 0)) (surface-line-width)]
[#:line-style line-style plot-pen-style/c (surface-line-style)]
[#:alpha alpha (real-in 0 1) (surface-alpha)]
[#:label label (or/c string? #f) #f]

View File

@ -45,7 +45,7 @@
[#:y-min y-min (or/c real? #f) #f] [#:y-max y-max (or/c real? #f) #f]
[#:z-min z-min (or/c real? #f) #f] [#:z-max z-max (or/c real? #f) #f]
[#:color color plot-color/c (line-color)]
[#:width width (real>=/c 0) (line-width)]
[#:width width (and/c real? (>=/c 0)) (line-width)]
[#:style style plot-pen-style/c (line-style)]
[#:alpha alpha (real-in 0 1) (line-alpha)]
[#:label label (or/c string? #f) #f]
@ -58,9 +58,9 @@
[#:x-min x-min (or/c real? #f) #f] [#:x-max x-max (or/c real? #f) #f]
[#:y-min y-min (or/c real? #f) #f] [#:y-max y-max (or/c real? #f) #f]
[#:z-min z-min (or/c real? #f) #f] [#:z-max z-max (or/c real? #f) #f]
[#:samples samples (integer>=/c 2) (line-samples)]
[#:samples samples (and/c exact-integer? (>=/c 2)) (line-samples)]
[#:color color plot-color/c (line-color)]
[#:width width (real>=/c 0) (line-width)]
[#:width width (and/c real? (>=/c 0)) (line-width)]
[#:style style plot-pen-style/c (line-style)]
[#:alpha alpha (real-in 0 1) (line-alpha)]
[#:label label (or/c string? #f) #f]

View File

@ -26,7 +26,7 @@
(defproc (plot3d/dc [renderer-tree (treeof renderer3d?)]
[dc (is-a?/c dc<%>)]
[x real?] [y real?] [width (real>=/c 0)] [height (real>=/c 0)]
[x real?] [y real?] [width (and/c real? (>=/c 0))] [height (and/c real? (>=/c 0))]
[#:x-min x-min (or/c real? #f) #f] [#:x-max x-max (or/c real? #f) #f]
[#:y-min y-min (or/c real? #f) #f] [#:y-max y-max (or/c real? #f) #f]
[#:z-min z-min (or/c real? #f) #f] [#:z-max z-max (or/c real? #f) #f]
@ -109,8 +109,8 @@
[#:x-min x-min (or/c real? #f) #f] [#:x-max x-max (or/c real? #f) #f]
[#:y-min y-min (or/c real? #f) #f] [#:y-max y-max (or/c real? #f) #f]
[#:z-min z-min (or/c real? #f) #f] [#:z-max z-max (or/c real? #f) #f]
[#:width width (integer>=/c 1) (plot-width)]
[#:height height (integer>=/c 1) (plot-height)]
[#:width width exact-positive-integer? (plot-width)]
[#:height height exact-positive-integer? (plot-height)]
[#:angle angle real? (plot3d-angle)]
[#:altitude altitude real? (plot3d-altitude)]
[#:title title (or/c string? #f) (plot-title)]
@ -131,8 +131,8 @@
[#:x-min x-min (or/c real? #f) #f] [#:x-max x-max (or/c real? #f) #f]
[#:y-min y-min (or/c real? #f) #f] [#:y-max y-max (or/c real? #f) #f]
[#:z-min z-min (or/c real? #f) #f] [#:z-max z-max (or/c real? #f) #f]
[#:width width (integer>=/c 1) (plot-width)]
[#:height height (integer>=/c 1) (plot-height)]
[#:width width exact-positive-integer? (plot-width)]
[#:height height exact-positive-integer? (plot-height)]
[#:angle angle real? (plot3d-angle)]
[#:altitude altitude real? (plot3d-altitude)]
[#:title title (or/c string? #f) (plot-title)]
@ -191,8 +191,8 @@
[#:x-min x-min (or/c real? #f) #f] [#:x-max x-max (or/c real? #f) #f]
[#:y-min y-min (or/c real? #f) #f] [#:y-max y-max (or/c real? #f) #f]
[#:z-min z-min (or/c real? #f) #f] [#:z-max z-max (or/c real? #f) #f]
[#:width width (integer>=/c 1) (plot-width)]
[#:height height (integer>=/c 1) (plot-height)]
[#:width width exact-positive-integer? (plot-width)]
[#:height height exact-positive-integer? (plot-height)]
[#:angle angle real? (plot3d-angle)]
[#:altitude altitude real? (plot3d-altitude)]
[#:title title (or/c string? #f) (plot-title)]
@ -216,8 +216,8 @@
[#:x-min x-min (or/c real? #f) #f] [#:x-max x-max (or/c real? #f) #f]
[#:y-min y-min (or/c real? #f) #f] [#:y-max y-max (or/c real? #f) #f]
[#:z-min z-min (or/c real? #f) #f] [#:z-max z-max (or/c real? #f) #f]
[#:width width (integer>=/c 1) (plot-width)]
[#:height height (integer>=/c 1) (plot-height)]
[#:width width exact-positive-integer? (plot-width)]
[#:height height exact-positive-integer? (plot-height)]
[#:angle angle real? (plot3d-angle)]
[#:altitude altitude real? (plot3d-altitude)]
[#:title title (or/c string? #f) (plot-title)]
@ -241,8 +241,8 @@
[#:x-min x-min (or/c real? #f) #f] [#:x-max x-max (or/c real? #f) #f]
[#:y-min y-min (or/c real? #f) #f] [#:y-max y-max (or/c real? #f) #f]
[#:z-min z-min (or/c real? #f) #f] [#:z-max z-max (or/c real? #f) #f]
[#:width width (integer>=/c 1) (plot-width)]
[#:height height (integer>=/c 1) (plot-height)]
[#:width width exact-positive-integer? (plot-width)]
[#:height height exact-positive-integer? (plot-height)]
[#:angle angle real? (plot3d-angle)]
[#:altitude altitude real? (plot3d-altitude)]
[#:title title (or/c string? #f) (plot-title)]
@ -288,8 +288,8 @@
[#:x-min x-min (or/c real? #f) #f] [#:x-max x-max (or/c real? #f) #f]
[#:y-min y-min (or/c real? #f) #f] [#:y-max y-max (or/c real? #f) #f]
[#:z-min z-min (or/c real? #f) #f] [#:z-max z-max (or/c real? #f) #f]
[#:width width (integer>=/c 1) (plot-width)]
[#:height height (integer>=/c 1) (plot-height)]
[#:width width exact-positive-integer? (plot-width)]
[#:height height exact-positive-integer? (plot-height)]
[#:angle angle real? #f] [#:altitude altitude real? #f]
[#:az az real? #f] [#:alt alt real? #f] ; backward-compatible aliases
[#:title title (or/c string? #f) (plot-title)]

View File

@ -27,8 +27,8 @@
[#:z-min z-min (or/c real? #f) #f] [#:z-max z-max (or/c real? #f) #f]
[#:sym sym point-sym/c (point-sym)]
[#:color color plot-color/c (point-color)]
[#:size size (real>=/c 0) (point-size)]
[#:line-width line-width (real>=/c 0) (point-line-width)]
[#:size size (and/c real? (>=/c 0)) (point-size)]
[#:line-width line-width (and/c real? (>=/c 0)) (point-line-width)]
[#:alpha alpha (real-in 0 1) (point-alpha)]
[#:label label (or/c string? #f) #f]
) renderer3d?

View File

@ -37,7 +37,7 @@
[#:color color plot-color/c (rectangle-color)]
[#:style style plot-brush-style/c (rectangle-style)]
[#:line-color line-color plot-color/c (rectangle-line-color)]
[#:line-width line-width (real>=/c 0) (rectangle3d-line-width)]
[#:line-width line-width (and/c real? (>=/c 0)) (rectangle3d-line-width)]
[#:line-style line-style plot-pen-style/c (rectangle-line-style)]
[#:alpha alpha (real-in 0 1) (rectangle-alpha)]
[#:label label (or/c string? #f) #f]
@ -88,7 +88,7 @@
[#:color color plot-color/c (rectangle-color)]
[#:style style plot-brush-style/c (rectangle-style)]
[#:line-color line-color plot-color/c (rectangle-line-color)]
[#:line-width line-width (real>=/c 0) (rectangle3d-line-width)]
[#:line-width line-width (and/c real? (>=/c 0)) (rectangle3d-line-width)]
[#:line-style line-style plot-pen-style/c (rectangle-line-style)]
[#:alpha alpha (real-in 0 1) (rectangle-alpha)]
[#:label label (or/c string? #f) #f]

View File

@ -51,11 +51,11 @@
[x-min (or/c real? #f) #f] [x-max (or/c real? #f) #f]
[y-min (or/c real? #f) #f] [y-max (or/c real? #f) #f]
[#:z-min z-min (or/c real? #f) #f] [#:z-max z-max (or/c real? #f) #f]
[#:samples samples (integer>=/c 2) (plot3d-samples)]
[#:samples samples (and/c exact-integer? (>=/c 2)) (plot3d-samples)]
[#:color color plot-color/c (surface-color)]
[#:style style plot-brush-style/c (surface-style)]
[#:line-color line-color plot-color/c (surface-line-color)]
[#:line-width line-width (real>=/c 0) (surface-line-width)]
[#:line-width line-width (and/c real? (>=/c 0)) (surface-line-width)]
[#:line-style line-style plot-pen-style/c (surface-line-style)]
[#:alpha alpha (real-in 0 1) (surface-alpha)]
[#:label label (or/c string? #f) #f]

View File

@ -8,8 +8,6 @@
@section{Convenience Contracts}
@doc-apply[real>=/c]
@doc-apply[integer>=/c]
@doc-apply[treeof]
@section{Appearance Argument Contracts}
@ -17,8 +15,6 @@
@doc-apply[anchor/c]
@doc-apply[color/c]
@doc-apply[plot-color/c]
@doc-apply[pen-style/c]
@doc-apply[brush-style/c]
@doc-apply[plot-pen-style/c]
@doc-apply[plot-brush-style/c]
@doc-apply[font-family/c]

View File

@ -10,8 +10,8 @@
@defproc[(plot [renderer-tree (treeof renderer2d?)]
[#:x-min x-min (or/c real? #f) #f] [#:x-max x-max (or/c real? #f) #f]
[#:y-min y-min (or/c real? #f) #f] [#:y-max y-max (or/c real? #f) #f]
[#:width width (integer>=/c 1) (plot-width)]
[#:height height (integer>=/c 1) (plot-height)]
[#:width width exact-positive-integer? (plot-width)]
[#:height height exact-positive-integer? (plot-height)]
[#:title title (or/c string? #f) (plot-title)]
[#:x-label x-label (or/c string? #f) (plot-x-label)]
[#:y-label y-label (or/c string? #f) (plot-y-label)]

View File

@ -12,8 +12,8 @@ Each 3D plot procedure corresponds with a @(secref "plot2d") procedure. Each beh
[#:x-min x-min (or/c real? #f) #f] [#:x-max x-max (or/c real? #f) #f]
[#:y-min y-min (or/c real? #f) #f] [#:y-max y-max (or/c real? #f) #f]
[#:z-min z-min (or/c real? #f) #f] [#:z-max z-max (or/c real? #f) #f]
[#:width width (integer>=/c 1) (plot-width)]
[#:height height (integer>=/c 1) (plot-height)]
[#:width width exact-positive-integer? (plot-width)]
[#:height height exact-positive-integer? (plot-height)]
[#:angle angle real? (plot3d-angle)]
[#:altitude altitude real? (plot3d-altitude)]
[#:title title (or/c string? #f) (plot-title)]