12 Compatibility Module
(require plot/compat) | package: plot-compat |
This module provides an interface compatible with Plot 5.1.3 and earlier.
Do not use this module in new programs. It is likely to disappear in a near future release.
Do not try to use both plot and plot/compat in the same program. The new features in Plot 5.2 and later require the objects plotted in plot have to be a different data type than the objects plotted in plot/compat. They do not coexist easily, and trying to make them do so will result in errors.
12.1 Plotting
procedure
(plot data [ #:width width #:height height #:x-min x-min #:x-max x-max #:y-min y-min #:y-max y-max #:x-label x-label #:y-label y-label #:title title #:fgcolor fgcolor #:bgcolor bgcolor #:lncolor lncolor #:out-file out-file]) → (is-a?/c image-snip%) data : (-> (is-a?/c 2d-plot-area%) void?) width : real? = 400 height : real? = 400 x-min : real? = -5 x-max : real? = 5 y-min : real? = -5 y-max : real? = 5 x-label : string? = "X axis" y-label : string? = "Y axis" title : string? = "" fgcolor : (list/c byte? byte? byte?) = '(0 0 0) bgcolor : (list/c byte? byte? byte?) = '(255 255 255) lncolor : (list/c byte? byte? byte?) = '(255 0 0) out-file : (or/c path-string? output-port? #f) = #f
A data value is represented as a procedure that takes a 2d-plot-area% instance and adds plot information to it.
The result is an image-snip% for the plot. If an #:out-file path or port is provided, the plot is also written as a PNG image to the given path or port.
The #:lncolor keyword argument is accepted for backward compatibility, but does nothing.
procedure
(plot3d data [ #:width width #:height height #:x-min x-min #:x-max x-max #:y-min y-min #:y-max y-max #:z-min z-min #:z-max z-max #:alt alt #:az az #:x-label x-label #:y-label y-label #:z-label z-label #:title title #:fgcolor fgcolor #:bgcolor bgcolor #:lncolor lncolor #:out-file out-file]) → (is-a?/c image-snip%) data : (-> (is-a?/c 3d-plot-area%) void?) width : real? = 400 height : real? = 400 x-min : real? = -5 x-max : real? = 5 y-min : real? = -5 y-max : real? = 5 z-min : real? = -5 z-max : real? = 5 alt : real? = 30 az : real? = 45 x-label : string? = "X axis" y-label : string? = "Y axis" z-label : string? = "Z axis" title : string? = "" fgcolor : (list/c byte? byte? byte?) = '(0 0 0) bgcolor : (list/c byte? byte? byte?) = '(255 255 255) lncolor : (list/c byte? byte? byte?) = '(255 0 0) out-file : (or/c path-string? output-port? #f) = #f
A 3D data value is represented as a procedure that takes a 3d-plot-area% instance and adds plot information to it.
The #:lncolor keyword argument is accepted for backward compatibility, but does nothing.
procedure
(points vecs [#:sym sym #:color color])
→ (-> (is-a?/c 2d-plot-area%) void?) vecs : (listof (vectorof real?)) sym : (or/c char? string? exact-integer? symbol?) = 'square color : plot-color? = 'black
procedure
(line f [ #:samples samples #:width width #:color color #:mode mode #:mapping mapping #:t-min t-min #:t-max t-max]) → (-> (is-a?/c 2d-plot-area%) void?) f : (-> real? (or/c real? (vector/c real? real?))) samples : (and/c exact-integer? (>=/c 2)) = 150 width : (>=/c 0) = 1 color : plot-color/c = 'red mode : (one-of/c 'standard 'parametric) = 'standard mapping : (one-of/c 'cartesian 'polar) = 'cartesian t-min : real? = -5 t-max : real? = 5
The line is specified in either functional, i.e. y = f(x), or parametric, i.e. x,y = f(t), mode. If the function is parametric, the mode argument must be set to 'parametric. The t-min and t-max arguments set the parameter when in parametric mode.
procedure
(error-bars vecs [#:color color])
→ (-> (is-a?/c 2d-plot-area%) void?) vecs : (listof (vector/c real? real? real?)) color : plot-color? = 'black
procedure
(vector-field f [ #:samples samples #:width width #:color color #:style style]) → (-> (is-a?/c 2d-plot-area%) void?) f : (-> (vector/c real? real?) (vector/c real? real?)) samples : (and/c exact-integer? (>=/c 2)) = 20 width : exact-positive-integer? = 1 color : plot-color? = 'red style : (one-of/c 'scaled 'normalized 'real) = 'scaled
procedure
(contour f [ #:samples samples #:width width #:color color #:levels levels]) → (-> (is-a?/c 2d-plot-area%) void?) f : (-> real? real? real?) samples : exact-nonnegative-integer? = 50 width : (>=/c 0) = 1 color : plot-color/c = 'black
levels : (or/c (and/c exact-integer? (>=/c 2)) (listof real?)) = 10
procedure
(shade f [#:samples samples #:levels levels])
→ (-> (is-a?/c 2d-plot-area%) void?) f : (-> real? real? real?) samples : (and/c exact-integer? (>=/c 2)) = 50
levels : (or/c (and/c exact-integer? (>=/c 2)) (listof real?)) = 10
procedure
(surface f [ #:samples samples #:width width #:color color]) → (-> (is-a?/c 3d-plot-area%) void?) f : (-> real? real? real?) samples : (and/c exact-integer? (>=/c 2)) = 50 width : (>=/c 0) = 1 color : plot-color/c = 'black
procedure
(plot-color? v) → boolean?
v : any/c
'white 'black 'yellow 'green 'aqua 'pink 'wheat 'grey 'blown 'blue 'violet 'cyan 'turquoise 'magenta 'salmon 'red
12.2 Miscellaneous Functions
procedure
(gradient f [h])
→ (-> (vector/c real? real?) (vector/c real? real?)) f : (-> real? real? real?) h : real? = #i1e-06
procedure
(make-vec fx fy)
→ (-> (vector/c real? real?) (vector/c real? real?)) fx : (-> real? real? real?) fy : (-> real? real? real?)