1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
#lang typed/racket/base
(require typed/racket/draw
"../common/type-doc.rkt"
"../common/types.rkt"
"../common/parameters.rkt"
"../common/nonrenderer.rkt"
"../plot2d/renderer.rkt"
"../plot3d/renderer.rkt"
"plot2d.rkt"
"plot3d.rkt"
typed/racket/unsafe)
(unsafe-provide plot plot3d)
(:: plot
(->* [(Treeof (U renderer2d nonrenderer))]
[#:x-min (U Real #f) #:x-max (U Real #f)
#:y-min (U Real #f) #:y-max (U Real #f)
#:width Positive-Integer
#:height Positive-Integer
#:title (U String #f)
#:x-label (U String #f)
#:y-label (U String #f)
#:legend-anchor Anchor
#:out-file (U Path-String Output-Port #f)
#:out-kind (U 'auto Image-File-Format)]
(Instance Bitmap%)))
(define (plot renderer-tree
#:x-min [x-min #f] #:x-max [x-max #f]
#:y-min [y-min #f] #:y-max [y-max #f]
#:width [width (plot-width)]
#:height [height (plot-height)]
#:title [title (plot-title)]
#:x-label [x-label (plot-x-label)]
#:y-label [y-label (plot-y-label)]
#:legend-anchor [legend-anchor (plot-legend-anchor)]
#:out-file [out-file #f]
#:out-kind [out-kind 'auto])
(when out-file
(plot-file renderer-tree out-file out-kind
#:x-min x-min #:x-max x-max #:y-min y-min #:y-max y-max #:width width #:height height
#:title title #:x-label x-label #:y-label y-label #:legend-anchor legend-anchor))
(plot-bitmap renderer-tree
#:x-min x-min #:x-max x-max #:y-min y-min #:y-max y-max #:width width #:height height
#:title title #:x-label x-label #:y-label y-label #:legend-anchor legend-anchor))
(:: plot3d
(->* [(Treeof (U renderer3d nonrenderer))]
[#:x-min (U Real #f) #:x-max (U Real #f)
#:y-min (U Real #f) #:y-max (U Real #f)
#:z-min (U Real #f) #:z-max (U Real #f)
#:width Positive-Integer
#:height Positive-Integer
#:angle Real #:altitude Real
#:title (U String #f)
#:x-label (U String #f)
#:y-label (U String #f)
#:z-label (U String #f)
#:legend-anchor Anchor
#:out-file (U Path-String Output-Port #f)
#:out-kind (U 'auto Image-File-Format)]
(Instance Bitmap%)))
(define (plot3d renderer-tree
#:x-min [x-min #f] #:x-max [x-max #f]
#:y-min [y-min #f] #:y-max [y-max #f]
#:z-min [z-min #f] #:z-max [z-max #f]
#:width [width (plot-width)]
#:height [height (plot-height)]
#:angle [angle (plot3d-angle)]
#:altitude [altitude (plot3d-altitude)]
#:title [title (plot-title)]
#:x-label [x-label (plot-x-label)]
#:y-label [y-label (plot-y-label)]
#:z-label [z-label (plot-z-label)]
#:legend-anchor [legend-anchor (plot-legend-anchor)]
#:out-file [out-file #f]
#:out-kind [out-kind 'auto])
(when out-file
(plot3d-file renderer-tree out-file out-kind
#:x-min x-min #:x-max x-max #:y-min y-min #:y-max y-max #:z-min z-min #:z-max z-max
#:width width #:height height #:title title
#:angle (or angle (plot3d-angle)) #:altitude (or altitude (plot3d-altitude))
#:x-label x-label #:y-label y-label #:z-label z-label #:legend-anchor legend-anchor))
(plot3d-bitmap renderer-tree
#:x-min x-min #:x-max x-max #:y-min y-min #:y-max y-max #:z-min z-min #:z-max z-max
#:width width #:height height #:title title
#:angle (or angle (plot3d-angle)) #:altitude (or altitude (plot3d-altitude))
#:x-label x-label #:y-label y-label #:z-label z-label #:legend-anchor legend-anchor))
|