misc cleanups to graphing code so sizing is easier and

change the labels in the legends
This commit is contained in:
Robby Findler 2014-03-24 09:17:47 -05:00
parent cc377272d6
commit 9c0317b04e

View File

@ -11,14 +11,21 @@
(provide (all-defined-out)) (provide (all-defined-out))
(define types (make-parameter '())) (define types (make-parameter '()))
(define all-types '(grammar search search-gen search-gen-enum search-gen-ref search-gen-enum-ref enum ordered)) (define all-types '(grammar search search-gen search-gen-enum search-gen-ref search-gen-enum-ref
(define names '("grammar" "search" "backjumping" "backjumping, ordered space" "backjumping, with refresh" enum ordered))
"backjumping, ordered space with refresh" "enumeration" (define names '("Ad Hoc Random Generation"
"in-order enumeration")) "search"
"backjumping"
"backjumping, ordered space"
"backjumping, with refresh"
"backjumping, ordered space with refresh"
"Random Selection from Uniform Distribution"
"In-order Enumeration"))
(define symbols '(circle triangle square asterisk diamond plus 5star diamond)) (define symbols '(circle triangle square asterisk diamond plus 5star diamond))
(define type-names (define type-names
(for/hash ([t all-types] [n names]) (for/hash ([t all-types] [n names])
(values t n))) (values t n)))
(define type-symbols (define type-symbols
(for/hash ([t all-types] [s symbols]) (for/hash ([t all-types] [s symbols])
(values t s))) (values t s)))
@ -84,13 +91,8 @@
(define (make-plot filenames) (define (make-plot filenames)
(parameterize ([plot-x-tick-label-angle 75] (parameterize ([plot-x-tick-label-angle 75]
[plot-x-tick-label-anchor 'right] [plot-x-tick-label-anchor 'right]
[plot-font-size 20]
[error-bar-line-width 3]
[error-bar-width 12] [error-bar-width 12]
[plot-line-width 3]
[plot-y-transform (axis-transform-bound log-transform 0.00001 +inf.0)] [plot-y-transform (axis-transform-bound log-transform 0.00001 +inf.0)]
[plot-width 1600]
[plot-height 800]
[plot-legend-anchor 'bottom-right]) [plot-legend-anchor 'bottom-right])
(define data (define data
@ -204,21 +206,19 @@
#:label (string-append (hash-ref type-names type) #:label (string-append (hash-ref type-names type)
(format " (~s successes)" (length this-type))) (format " (~s successes)" (length this-type)))
#:sym (hash-ref type-symbols type) #:sym (hash-ref type-symbols type)
#:size 20 #:size (* (point-size) 1.5)
#:line-width 2
#:color (add1 n))) #:color (add1 n)))
(if (equal? type 'ordered) (if (equal? type 'ordered)
ps ps
(list ps (list (error-bars
(error-bars
(map (λ (d) (map (λ (d)
(list (get-name-num (list-ref d 0) n) (list (get-name-num (list-ref d 0) n)
(list-ref d 2) (list-ref d 2)
(list-ref d 3))) (list-ref d 3)))
this-type) this-type)
#:y-min 0.01 #:y-min 0.01
#:line-width 1 #:color "dark gray")
#:color (length (member type all-types)))))) ps)))
(define (zero->neg n) (define (zero->neg n)
(if (zero? n) (if (zero? n)
@ -235,48 +235,38 @@
"" ""
(car label-list))) (car label-list)))
(plot-x-ticks (ticks (linear-ticks-layout #:number 30 #:base 10 (parameterize ([plot-x-ticks
#:divisors '(1)) (ticks (linear-ticks-layout #:number 30 #:base 10
(λ (_1 _2 pts) (map tlabel pts)))) #:divisors '(1))
(λ (_1 _2 pts) (map tlabel pts)))]
[plot-y-ticks
(log-ticks #:number 20 #:base 10)]
[plot-y-label "Average Number of Seconds to Find Each Bug"]
[plot-x-label ""])
(define (loggy-ticks _1 _2) (if (output-file)
(for*/list (plot
([f (in-list '(1 10 100 1000 10000))] (for/list ([t (if (empty? (types)) all-types (types))]
[n (in-range 1 10)]) [n (in-naturals)])
(pre-tick (* f n) (or (plot-type t n))
(= n 5) #:x-min 0
(= n 1))))) #:y-min (min-y)
#:y-max (if (max-t)
(plot-y-ticks (* 60 (max-t))
(log-ticks #:number 20 #:base 10)) (+ 5 (/ (apply max (filter values (map (λ (d) (list-ref d 2)) data))) 1000)))
#:x-max (+ 0.5 (length (hash-keys name-avgs)))
(if (output-file) #:out-file (output-file)
(plot #:out-kind 'jpeg)
(for/list ([t (if (empty? (types)) all-types (types))] (plot-pict
[n (in-naturals)]) (for/list ([t (if (empty? (types)) all-types (types))]
(plot-type t n)) [n (in-naturals)])
#:y-label "avg. seconds to find bug" (plot-type t n))
#:x-label "file" #:x-min 0
#:x-min 0 #:y-min (min-y)
#:y-min (min-y) #:y-max (if (max-t)
#:y-max (if (max-t) (* 60 (max-t))
(* 60 (max-t)) (+ 5 (/ (apply max (filter values (map (λ (d) (list-ref d 2)) data))) 1000)))
(+ 5 (/ (apply max (filter values (map (λ (d) (list-ref d 2)) data))) 1000))) #:x-max (+ 0.5 (length (hash-keys name-avgs))))))))
#:x-max (+ 0.5 (length (hash-keys name-avgs)))
#:out-file (output-file)
#:out-kind 'jpeg)
(plot-pict
(for/list ([t (if (empty? (types)) all-types (types))]
[n (in-naturals)])
(plot-type t n))
#:y-label "avg. seconds to find bug"
#:x-label "file"
#:x-min 0
#:y-min (min-y)
#:y-max (if (max-t)
(* 60 (max-t))
(+ 5 (/ (apply max (filter values (map (λ (d) (list-ref d 2)) data))) 1000)))
#:x-max (+ 0.5 (length (hash-keys name-avgs)))))))
(module+ (module+