diff --git a/collects/plot/plot2d/contour.rkt b/collects/plot/plot2d/contour.rkt index 09c072a1f6..3f313a0f8c 100644 --- a/collects/plot/plot2d/contour.rkt +++ b/collects/plot/plot2d/contour.rkt @@ -44,11 +44,12 @@ [#:style style plot-pen-style/c (line-style)] [#:alpha alpha (real-in 0 1) (line-alpha)] [#:label label (or/c string? #f) #f] + [#:add-ticks? add-ticks? boolean? #t] ) renderer2d? (define x-ivl (ivl x-min x-max)) (define y-ivl (ivl y-min y-max)) (define g (2d-function->sampler f (vector x-ivl y-ivl))) - (renderer2d (vector x-ivl y-ivl) #f default-ticks-fun + (renderer2d (vector x-ivl y-ivl) #f (if add-ticks? default-ticks-fun #f) (isoline-render-proc g z samples color width style alpha label))) ;; =================================================================================================== @@ -100,11 +101,12 @@ [#:styles styles (plot-pen-styles/c (listof real?)) (contour-styles)] [#:alphas alphas (alphas/c (listof real?)) (contour-alphas)] [#:label label (or/c string? #f) #f] + [#:add-ticks? add-ticks? boolean? #t] ) renderer2d? (define x-ivl (ivl x-min x-max)) (define y-ivl (ivl y-min y-max)) (define g (2d-function->sampler f (vector x-ivl y-ivl))) - (renderer2d (vector x-ivl y-ivl) #f default-ticks-fun + (renderer2d (vector x-ivl y-ivl) #f (if add-ticks? default-ticks-fun #f) (contours-render-proc g levels samples colors widths styles alphas label))) ;; =================================================================================================== @@ -180,11 +182,12 @@ [#:contour-styles contour-styles (plot-pen-styles/c (listof real?)) (contour-styles)] [#:alphas alphas (alphas/c (listof ivl?)) (contour-interval-alphas)] [#:label label (or/c string? #f) #f] + [#:add-ticks? add-ticks? boolean? #t] ) renderer2d? (define x-ivl (ivl x-min x-max)) (define y-ivl (ivl y-min y-max)) (define g (2d-function->sampler f (vector x-ivl y-ivl))) - (renderer2d (vector x-ivl y-ivl) #f default-ticks-fun + (renderer2d (vector x-ivl y-ivl) #f (if add-ticks? default-ticks-fun #f) (contour-intervals-render-proc g levels samples colors styles contour-colors contour-widths contour-styles alphas label))) diff --git a/collects/plot/plot2d/interval.rkt b/collects/plot/plot2d/interval.rkt index edc89e8fe9..efcbeb23b2 100644 --- a/collects/plot/plot2d/interval.rkt +++ b/collects/plot/plot2d/interval.rkt @@ -47,6 +47,7 @@ [#: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] + [#:add-ticks? add-ticks? boolean? #t] ) renderer2d? (define rvs (filter vrational? (append v1s v2s))) (cond @@ -57,7 +58,8 @@ [x-max (if x-max x-max (apply max* rxs))] [y-min (if y-min y-min (apply min* rys))] [y-max (if y-max y-max (apply max* rys))]) - (renderer2d (vector (ivl x-min x-max) (ivl y-min y-max)) #f default-ticks-fun + (renderer2d (vector (ivl x-min x-max) (ivl y-min y-max)) #f + (if add-ticks? default-ticks-fun #f) (lines-interval-render-proc v1s v2s color style line1-color line1-width line1-style line2-color line2-width line2-style @@ -80,6 +82,7 @@ [#: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] + [#:add-ticks? add-ticks? boolean? #t] ) renderer2d? (lines-interval (map f1 (linear-seq t-min t-max samples)) @@ -88,7 +91,7 @@ #:color color #:style style #:line1-color line1-color #:line1-width line1-width #:line1-style line1-style #:line2-color line2-color #:line2-width line2-width #:line2-style line2-style - #:alpha alpha #:label label)) + #:alpha alpha #:label label #:add-ticks? add-ticks?)) (defproc (polar-interval [f1 (real? . -> . real?)] [f2 (real? . -> . real?)] @@ -106,6 +109,7 @@ [#: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] + [#:add-ticks? add-ticks? boolean? #t] ) renderer2d? (define θs (linear-seq θ-min θ-max samples)) (lines-interval @@ -115,7 +119,7 @@ #:color color #:style style #:line1-color line1-color #:line1-width line1-width #:line1-style line1-style #:line2-color line2-color #:line2-width line2-width #:line2-style line2-style - #:alpha alpha #:label label)) + #:alpha alpha #:label label #:add-ticks? add-ticks?)) ;; =================================================================================================== ;; Function @@ -152,6 +156,7 @@ [#: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] + [#:add-ticks? add-ticks? boolean? #t] ) renderer2d? (define x-ivl (ivl x-min x-max)) (define y-ivl (ivl y-min y-max)) @@ -159,7 +164,7 @@ (define g2 (function->sampler f2 x-ivl)) (renderer2d (vector x-ivl y-ivl) (function-interval-bounds-fun g1 g2 samples) - default-ticks-fun + (if add-ticks? default-ticks-fun #f) (function-interval-render-proc g1 g2 samples color style line1-color line1-width line1-style line2-color line2-width line2-style @@ -200,6 +205,7 @@ [#: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] + [#:add-ticks? add-ticks? boolean? #t] ) renderer2d? (define x-ivl (ivl x-min x-max)) (define y-ivl (ivl y-min y-max)) @@ -207,7 +213,7 @@ (define g2 (inverse->sampler f2 y-ivl)) (renderer2d (vector x-ivl y-ivl) (inverse-interval-bounds-fun g1 g2 samples) - default-ticks-fun + (if add-ticks? default-ticks-fun #f) (inverse-interval-render-proc g1 g2 samples color style line1-color line1-width line1-style line2-color line2-width line2-style diff --git a/collects/plot/plot2d/line.rkt b/collects/plot/plot2d/line.rkt index 22732d5e4e..5a523ce783 100644 --- a/collects/plot/plot2d/line.rkt +++ b/collects/plot/plot2d/line.rkt @@ -27,6 +27,7 @@ [#:style style plot-pen-style/c (line-style)] [#:alpha alpha (real-in 0 1) (line-alpha)] [#:label label (or/c string? #f) #f] + [#:add-ticks? add-ticks? boolean? #t] ) renderer2d? (define rvs (filter vrational? vs)) (cond [(empty? rvs) (renderer2d #f #f #f #f)] @@ -36,7 +37,8 @@ [x-max (if x-max x-max (apply max* rxs))] [y-min (if y-min y-min (apply min* rys))] [y-max (if y-max y-max (apply max* rys))]) - (renderer2d (vector (ivl x-min x-max) (ivl y-min y-max)) #f default-ticks-fun + (renderer2d (vector (ivl x-min x-max) (ivl y-min y-max)) #f + (if add-ticks? default-ticks-fun #f) (lines-render-proc vs color width style alpha label)))])) (defproc (parametric [f (real? . -> . (vector/c real? real?))] @@ -49,11 +51,12 @@ [#:style style plot-pen-style/c (line-style)] [#:alpha alpha (real-in 0 1) (line-alpha)] [#:label label (or/c string? #f) #f] + [#:add-ticks? add-ticks? boolean? #t] ) renderer2d? (lines (map f (linear-seq t-min t-max samples)) #:x-min x-min #:x-max x-max #:y-min y-min #:y-max y-max #:color color #:width width #:style style #:alpha alpha - #:label label)) + #:label label #:add-ticks? add-ticks?)) (defproc (polar [f (real? . -> . real?)] [θ-min real? 0] [θ-max real? (* 2 pi)] @@ -65,12 +68,13 @@ [#:style style plot-pen-style/c (line-style)] [#:alpha alpha (real-in 0 1) (line-alpha)] [#:label label (or/c string? #f) #f] + [#:add-ticks? add-ticks? boolean? #t] ) renderer2d? (lines (let ([θs (linear-seq θ-min θ-max samples)]) (map polar->cartesian θs (map* f θs))) #:x-min x-min #:x-max x-max #:y-min y-min #:y-max y-max #:color color #:width width #:style style #:alpha alpha - #:label label)) + #:label label #:add-ticks? add-ticks?)) ;; =================================================================================================== ;; Function @@ -95,13 +99,14 @@ [#:style style plot-pen-style/c (line-style)] [#:alpha alpha (real-in 0 1) (line-alpha)] [#:label label (or/c string? #f) #f] + [#:add-ticks? add-ticks? boolean? #t] ) renderer2d? (define x-ivl (ivl x-min x-max)) (define y-ivl (ivl y-min y-max)) (let ([f (function->sampler f x-ivl)]) (renderer2d (vector x-ivl y-ivl) (function-bounds-fun f samples) - default-ticks-fun + (if add-ticks? default-ticks-fun #f) (function-render-proc f samples color width style alpha label)))) ;; =================================================================================================== @@ -127,13 +132,14 @@ [#:style style plot-pen-style/c (line-style)] [#:alpha alpha (real-in 0 1) (line-alpha)] [#:label label (or/c string? #f) #f] + [#:add-ticks? add-ticks? boolean? #t] ) renderer2d? (define x-ivl (ivl x-min x-max)) (define y-ivl (ivl y-min y-max)) (define g (inverse->sampler f y-ivl)) (renderer2d (vector x-ivl y-ivl) (inverse-bounds-fun g samples) - default-ticks-fun + (if add-ticks? default-ticks-fun #f) (inverse-render-proc g samples color width style alpha label))) ;; =================================================================================================== @@ -148,6 +154,7 @@ [#:style style plot-pen-style/c (line-style)] [#:alpha alpha (real-in 0 1) (line-alpha)] [#:label label (or/c string? #f) #f] + [#:add-ticks? add-ticks? boolean? #t] ) renderer2d? (define n (length xs)) (define sd (sqrt (- (/ (sum sqr xs) n) (sqr (/ (sum values xs) n))))) @@ -156,4 +163,5 @@ (let ([x-min (if x-min x-min fx-min)] [x-max (if x-max x-max fx-max)]) (function f x-min x-max #:y-min y-min #:y-max y-max #:samples samples - #:color color #:width width #:style style #:alpha alpha #:label label))) + #:color color #:width width #:style style #:alpha alpha #:label label + #:add-ticks? add-ticks?))) diff --git a/collects/plot/plot2d/point.rkt b/collects/plot/plot2d/point.rkt index e582937738..777d779ad0 100644 --- a/collects/plot/plot2d/point.rkt +++ b/collects/plot/plot2d/point.rkt @@ -29,6 +29,7 @@ [#:line-width line-width (>=/c 0) (point-line-width)] [#:alpha alpha (real-in 0 1) (point-alpha)] [#:label label (or/c string? #f) #f] + [#:add-ticks? add-ticks? boolean? #t] ) renderer2d? (let ([vs (filter vrational? vs)]) (cond @@ -39,7 +40,8 @@ [y-min (if y-min y-min (apply min* ys))] [y-max (if y-max y-max (apply max* ys))]) (renderer2d - (vector (ivl x-min x-max) (ivl y-min y-max)) #f default-ticks-fun + (vector (ivl x-min x-max) (ivl y-min y-max)) #f + (if add-ticks? default-ticks-fun #f) (points-render-fun vs sym color (cond [(eq? fill-color 'auto) (->pen-color color)] [else fill-color]) size line-width alpha label)))]))) @@ -100,10 +102,12 @@ [#: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] + [#:add-ticks? add-ticks? boolean? #t] ) renderer2d? (let ([f (cond [(procedure-arity-includes? f 2 #t) f] [else (λ (x y) (f (vector x y)))])]) - (renderer2d (vector (ivl x-min x-max) (ivl y-min y-max)) #f default-ticks-fun + (renderer2d (vector (ivl x-min x-max) (ivl y-min y-max)) #f + (if add-ticks? default-ticks-fun #f) (vector-field-render-fun f samples scale color line-width line-style alpha label)))) ;; =================================================================================================== @@ -134,6 +138,7 @@ [#:line-style line-style plot-pen-style/c (error-bar-line-style)] [#:width width (>=/c 0) (error-bar-width)] [#:alpha alpha (real-in 0 1) (error-bar-alpha)] + [#:add-ticks? add-ticks? boolean? #t] ) renderer2d? (let ([bars (filter vrational? bars)]) (cond [(empty? bars) (renderer2d #f #f #f #f)] @@ -143,6 +148,7 @@ [x-max (if x-max x-max (apply max* xs))] [y-min (if y-min y-min (apply min* (map - ys hs)))] [y-max (if y-max y-max (apply max* (map + ys hs)))]) - (renderer2d (vector (ivl x-min x-max) (ivl y-min y-max)) #f default-ticks-fun + (renderer2d (vector (ivl x-min x-max) (ivl y-min y-max)) #f + (if add-ticks? default-ticks-fun #f) (error-bars-render-fun xs ys hs color line-width line-style width alpha)))]))) diff --git a/collects/plot/plot2d/rectangle.rkt b/collects/plot/plot2d/rectangle.rkt index c1dcba5186..5ca86ee9d0 100644 --- a/collects/plot/plot2d/rectangle.rkt +++ b/collects/plot/plot2d/rectangle.rkt @@ -34,6 +34,7 @@ [#: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] + [#:add-ticks? add-ticks? boolean? #t] ) renderer2d? (match-define (list (vector (ivl x1s x2s) (ivl y1s y2s)) ...) rects) (define rxs (filter rational? (append x1s x2s))) @@ -45,7 +46,8 @@ [x-max (if x-max x-max (apply max* rxs))] [y-min (if y-min y-min (apply min* rys))] [y-max (if y-max y-max (apply max* rys))]) - (renderer2d (vector (ivl x-min x-max) (ivl y-min y-max)) #f default-ticks-fun + (renderer2d (vector (ivl x-min x-max) (ivl y-min y-max)) #f + (if add-ticks? default-ticks-fun #f) (rectangles-render-proc rects color style line-color line-width line-style alpha label)))])) @@ -65,6 +67,7 @@ [#: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] + [#:add-ticks? add-ticks? boolean? #t] ) renderer2d? (let* ([bin-bounds (filter rational? bin-bounds)] [bin-bounds (sort bin-bounds <)]) @@ -84,7 +87,7 @@ (bounds->intervals bin-bounds) heights) #:x-min x-min #:x-max x-max #:y-min y-min #:y-max y-max #:color color #:style style #:line-color line-color #:line-width line-width - #:line-style line-style #:alpha alpha #:label label)]))) + #:line-style line-style #:alpha alpha #:label label #:add-ticks? add-ticks?)]))) ;; =================================================================================================== ;; Discrete histograms @@ -118,6 +121,7 @@ [#: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] + [#:add-ticks? add-ticks? boolean? #t] [#:far-ticks? far-ticks? boolean? #f] ) renderer2d? (match-define (list (vector cats ys) ...) cat-vals) @@ -141,7 +145,7 @@ (define maybe-invert (if invert? (λ (x y) (vector y x)) vector)) (renderer2d (maybe-invert (ivl x-min x-max) (ivl y-min y-max)) #f - (discrete-histogram-ticks-fun cats tick-xs far-ticks? maybe-invert) + (if add-ticks? (discrete-histogram-ticks-fun cats tick-xs far-ticks? maybe-invert) #f) (rectangles-render-proc (map maybe-invert x-ivls y-ivls) color style line-color line-width line-style alpha label)))])) @@ -159,6 +163,7 @@ [#:line-styles line-styles (plot-pen-styles/c nat/c) (stacked-histogram-line-styles)] [#:alphas alphas (alphas/c nat/c) (stacked-histogram-alphas)] [#:labels labels (labels/c nat/c) '(#f)] + [#:add-ticks? add-ticks? boolean? #t] [#:far-ticks? far-ticks? boolean? #f] ) (listof renderer2d?) (match-define (list (vector cats ys) ...) cat-vals) @@ -180,4 +185,5 @@ #:x-min x-min #:x-max x-max #:y-min y-min #:y-max y-max #:gap gap #:skip skip #:invert? invert? #:color color #:style style #:line-color line-color #:line-width line-width - #:line-style line-style #:alpha alpha #:label label #:far-ticks? far-ticks?))) + #:line-style line-style #:alpha alpha #:label label + #:add-ticks? add-ticks? #:far-ticks? far-ticks?)))