5
-2
procedure
( real->plot-label xdigits[scientific?])→string?
x:real?digits:exact-integer?
".02556"
"2352300"
"1×10⁹"
"(1×10⁹)+.1234"
procedure
( ivl->plot-label i[extra-digits])→string?
i:ivl?
"[-10.52,10.99]"
"[-inf.0,3.141592653589793]"
procedure
( ->plot-label a[digits])→string?
a:any/c
procedure
( real->string/trunc xe)→string?
x:real?
procedure
min-digitsx:real?min-digits:exact-nonnegative-integer?
"1.00000"
"1.123456"
"1.1234567891"
procedure
"⁻¹²³⁴⁵⁶⁷⁸⁹⁰"
This function is used internally to generate sample points.
'(0 1/4 1/2 3/4 1)
'(1/9 1/3 5/9 7/9 1)
'(0 2/9 4/9 2/3 8/9)
'(1/10 3/10 1/2 7/10 9/10)
procedure
num[ #:start?start?
'(0 1/2 1 3/2 2)
'(0 2/5 4/5 6/5 8/5 2)
'(0 1/2 1 1/2 0)
procedure
endnumtransform[ #:start?start?start:real?end:real?transform:axis-transform/c
'(1 4 7 10)
'(1.0 2.154434690031884 4.641588833612779 10.000000000000002)
procedure
( silverman-bandwidth xs)→real?
Added in version 8.5 of package plot-lib.
#:levels4#:contour-styles'(transparent)
procedure
num[ #:start?start?#:end?end?])
#:levels4#:contour-styles'(transparent)
Symbols are converted to strings, and strings are looked up in a color-database<%> . Lists are unchanged, and color% objects are converted straightforwardly.
'(36 36 140)
'(36 36 140)
'(36 36 140)
'(36 36 140)
This function does not convert integers to RGB triplets, because there is no way for it to know whether the color will be used for a pen or for a brush. Use ->pen-color and ->brush-color to convert integers.
procedure
( ->pen-color c)→(list/c real? real? real? )
#f
#:levels7#:contour-styles'(transparent)
The example above is using the internal color map, with plot-pen-color-map set to #f.
procedure
( ->brush-color c)→(list/c real? real? real? )
#f
#:levels7#:contour-styles'(transparent)
The example above is using the internal color map, with plot-brush-color-map is set to #f. In this example, map ping ->brush-color over the list is actually unnecessary, because contour-intervals uses ->brush-color internally to convert fill colors.
#:line1-width4#:line2-width4))
procedure
( ->pen-style s)→symbol?
#t
'(solid dot long-dash short-dash dot-dash)
procedure
( ->brush-style s)→symbol?
#t
'(solid bdiagonal-hatch fdiagonal-hatch crossdiag-hatch)
'(horizontal-hatch vertical-hatch cross-hatch)
procedure
( color-map-names )→(listof symbol? )
Added in version 7.3 of package plot-lib.
procedure
( color-map-size name)→integer?
name:symbol?
Added in version 7.3 of package plot-lib.
procedure
( register-color-map namecolor-map)→void
name:symbol?
Added in version 7.3 of package plot-lib.
procedure
2.0
2
-2.0
-3
procedure
( floor-log/base bx)→exact-integer?
2.0
2
2.0
3
procedure
( maybe-inexact->exact x)→(or/c rational? #f)
procedure
( vnormalize v)→(vectorof real? )
'#(0.7071067811865475 0.7071067811865475 0)
'#(0.5773502691896258 0.5773502691896258 0.5773502691896258)
'#(0 0 0.0)
'#(3/2 3/2)
procedure
( vrational? v)→boolean?
#t
#f
vrational?: contract violation
expected: real?
given: #f
in: an element of
the 1st argument of
(-> (vectorof real?) any)
contract from:
<pkgs>/plot-lib/plot/private/common/math.rkt
blaming: top-level
(assuming the contract is correct)
at: <pkgs>/plot-lib/plot/private/common/math.rkt:304:9
(ivl -inf.0 0)
(ivl 0 +inf.0)
(ivl -inf.0 +inf.0)
Functions that return rectangle renderers, such as rectangles and discrete-histogram3d , accept vectors of ivl s as arguments. The ivl struct type is also provided by plot so users of such renderers do not have to require plot/utils.
procedure
( rational-ivl? i)→boolean?
i:any/c
'(#t #f #f)
procedure
( bounds->intervals xs)→(listof ivl? )
(list (ivl 0 1/4) (ivl 1/4 1/2) (ivl 1/2 3/4) (ivl 3/4 1))
procedure
( clamp-real xi)→real?
x:real?i:ivl?
procedure
( datetime->real x)→real?
For dates, the value returned is the number of seconds since a system-dependent UTC epoch. See date-ticks for more information.
To plot a time series using dates pulled from an SQL database, simply set the relevant axis ticks (probably plot-x-ticks ) to date-ticks , and convert the dates to seconds using datetime->real before passing them to lines . To keep time zone offsets from influencing the plot, set them to 0 first.
#:extra-constructor-namemake-plot-time)day:exact-integer?
Plot (specifically time-ticks ) uses plot-time internally to format times, but because renderer-producing functions require only real values, user code should not need it. It is provided just in case.
procedure
( plot-time->seconds t)→real?
procedure
s:real?
(plot-time 4 1 2 3)
interface
Return the bounds of the plot as a vector of minimum and maximum values, one for each axis in the plot. For 2D plots, this method returns a vector of two elements, for the X and Y axes, while 3D plots return a vector of three elements for the X, Y and Z axes.The values returned are in plot coordinates, to obtain the coordinates on the drawing surface (i.e. image coordinates), use plot->dc on these bounds.
Plot bounds for interactive plots, like those produced by plot and plot-snip , can change as the user zoom in and out the plot, get-plot-bounds always returns the current bounds of the plot, but they might be invalidated by a user operation.
Convert coordinates from plot coordinate system to the drawing coordinate system (that is, image coordinates). For 2D plots, coordinates is a vector of two values, the X and Y coordinates on the plot, while for 3D plots it is a vector of three values, the X, Y and Z coordinates.This method can be used, for example, to determine the actual location on the image where the coordinates 0, 0 are. It can also be used to determine the location of the plot area inside the image, by calling it on the plot bounds returned by get-plot-bounds .
For interactive plots, the coordinates might change as the user zooms in and out the plot.
For 2D plots, this method returns the 2D plot coordinates that correspond to the input coordinates, which are in the draw context coordinate system.For 3D plots, this method returns a 3D position on the plane perpendicular to the user view for the plot. Together with the normal vector for this plane, returned by plane-vector , the projection line can be reconstructed.
This is the reverse operation from plot->dc and same remark about the user zooming in and out the plot applies.
method
(send a-plot-metrics plane-vector )→(vectorof real? )
Return the unit vector representing the normal of the screen through the plot origin. For 2D plots this always returns #(001), for 3D plots this unit vector can be used to reconstruct plot coordinates from draw context coordinates.For interactive 3D plots, the returned value will change if the user rotates the plot.
Added in version 8.1 of package plot-lib.
procedure
( plot-pict? any)→boolean?
any:any/c
Added in version 8.1 of package plot-lib.
procedure
( plot-pict-bounds plot)→(vectorof (vector/c real? real? ))
plot:plot-pict?
Added in version 8.1 of package plot-lib.
procedure
( plot-pict-plot->dc plotcoordinates)→(vectorof real? )
plot:plot-pict?
Added in version 8.1 of package plot-lib.
procedure
( plot-pict-dc->plot plotcoordinates)→(vectorof real? )
plot:plot-pict?
Added in version 8.1 of package plot-lib.
procedure
( plot-pict-plane-vector plot)→(vectorof real? )
plot:plot-pict?
Added in version 8.1 of package plot-lib.