61 Point Markers, Scatter Plots, and Filled Areas
Point markers, ordered scatter-plot groups, and closed areas represent data and regions derived from sampled function graphs or ordered data series. These values remain ordinary immutable Visuals. They use the existing affine, opacity, group, path, timeline, camera, and renderer protocols.
procedure
(point-marker-shape? value) → boolean?
value : any/c
'circle 'square 'diamond 'triangle-up 'triangle-down
The set is explicit. Other symbols are rejected.
procedure
(point-marker #:id identifier [ #:center center #:rotation rotation #:scale scale #:opacity opacity #:shape shape #:size size #:fill fill #:stroke stroke #:stroke-width stroke-width]) → point-marker-visual? identifier : symbol? center : vec2? = origin rotation : finite-real? = 0 scale : any/c = 1 opacity : opacity? = 1 shape : point-marker-shape? = 'circle size : positive-real? = 1/5 fill : any/c = "royalblue" stroke : any/c = "black" stroke-width : nonnegative-real? = 1
The marker implements the basic Visual, affine-Visual, and opacity-Visual protocols. It can therefore be moved, rotated, scaled, faded, grouped, and used with renderer-aware layout.
The constructor rejects a non-symbol identity, non-finite position or rotation, nonpositive scale or size, opacity outside the closed unit interval, an unknown shape, and a negative or non-finite stroke width. Fill and stroke values are passed to the selected rendering backend in the same way as for the existing circle, rectangle, and path Visuals.
procedure
(point-marker-visual? value) → boolean?
value : any/c
procedure
(point-marker-visual-shape visual) → point-marker-shape?
visual : point-marker-visual?
procedure
(point-marker-visual-size visual) → positive-real?
visual : point-marker-visual?
procedure
(point-marker-visual-fill visual) → any/c
visual : point-marker-visual?
procedure
(point-marker-visual-stroke visual) → any/c
visual : point-marker-visual?
procedure
(point-marker-visual-stroke-width visual) → nonnegative-real?
visual : point-marker-visual?
The default Pict adapter converts marker shapes to existing semantic circle, rectangle, or path primitives after explicit renderer selection. A custom renderer placed before the defaults can override the complete marker. Semantic opacity is applied once after either custom rendering or fallback conversion.
procedure
(scatter-plot axes points #:id identifier [ #:clip? clip? #:shape shape #:size size #:opacity opacity #:fill fill #:stroke stroke #:stroke-width stroke-width]) → group-visual? axes : axes-visual? points : (listof (or/c vec2? false/c)) identifier : symbol? clip? : boolean? = #t shape : point-marker-shape? = 'circle size : positive-real? = 1/5 opacity : opacity? = 1 fill : any/c = "royalblue" stroke : any/c = "black" stroke-width : nonnegative-real? = 1
Visible markers preserve input order. Their identities are derived from the plot identity and original zero-based list index:
plot-id-marker-index |
Indexes are not renumbered when a #f value or clipped point is omitted. The returned group copies the current axes center and rotation. Numeric marker positions include the current x and y axes scale, while the markers themselves start upright and keep the requested world-unit size. This is a construction-time snapshot. Later changes to the axes do not update the scatter plot.
The opacity argument belongs to the complete returned group. Individual marker children start with opacity one. The returned group can be transformed or faded through the ordinary timeline requests.
The constructor rejects anything other than a proper list of vec2 values and #f gaps. It also validates the identity, clipping flag, shape, positive finite size, opacity, and nonnegative finite stroke width before creating any marker child.
procedure
(sample-function-area-path axes function [ #:baseline baseline #:x-min x-min #:x-max x-max #:sample-count sample-count #:clip? clip? #:max-jump max-jump #:interpolation interpolation]) → path-geometry? axes : axes-visual? function : (procedure-arity-includes/c 1) baseline : finite-real? = 0 x-min : (or/c finite-real? false/c) = #f x-max : (or/c finite-real? false/c) = #f sample-count : exact-integer? = 201 clip? : boolean? = #t max-jump : (or/c nonnegative-real? false/c) = #f interpolation : curve-interpolation? = 'smooth
When clipping is enabled, baseline is clamped to the displayed y range. The graph segments are clipped first, and only the visible accepted runs are closed. Therefore this operation fills beneath the visible sampled graph path; it does not reconstruct a region whose complete graph lies outside the display. Each discontinuous run becomes a separate closed region. Smooth cubic graph segments remain cubic inside the area.
The baseline must be finite. All other domain, sample-count, callback-result, exception, clipping, jump, and interpolation errors are the same as for sample-function-path. Sampling stops at the first reported error.
procedure
(function-area axes function #:id identifier [ #:baseline baseline #:x-min x-min #:x-max x-max #:sample-count sample-count #:clip? clip? #:max-jump max-jump #:interpolation interpolation #:opacity opacity #:fill fill #:stroke stroke #:stroke-width stroke-width]) → path-visual? axes : axes-visual? function : (procedure-arity-includes/c 1) identifier : symbol? baseline : finite-real? = 0 x-min : (or/c finite-real? false/c) = #f x-max : (or/c finite-real? false/c) = #f sample-count : exact-integer? = 201 clip? : boolean? = #t max-jump : (or/c nonnegative-real? false/c) = #f interpolation : curve-interpolation? = 'smooth opacity : opacity? = 1/2 fill : any/c = "cornflowerblue" stroke : any/c = #f stroke-width : nonnegative-real? = 0
The identity must be a symbol, opacity must be in the closed unit interval, and stroke width must be a nonnegative finite real. Sampling and baseline errors are reported by sample-function-area-path.
procedure
(data-series-area-path axes points [ #:baseline baseline #:clip? clip? #:max-distance max-distance #:interpolation interpolation]) → path-geometry? axes : axes-visual? points : (listof (or/c vec2? false/c)) baseline : finite-real? = 0 clip? : boolean? = #t max-distance : (or/c nonnegative-real? false/c) = #f interpolation : curve-interpolation? = 'linear
The baseline must be finite. Point-list, clipping, distance, and interpolation errors are the same as for data-series-path.
procedure
(data-area axes points #:id identifier [ #:baseline baseline #:clip? clip? #:max-distance max-distance #:interpolation interpolation #:opacity opacity #:fill fill #:stroke stroke #:stroke-width stroke-width]) → path-visual? axes : axes-visual? points : (listof (or/c vec2? false/c)) identifier : symbol? baseline : finite-real? = 0 clip? : boolean? = #t max-distance : (or/c nonnegative-real? false/c) = #f interpolation : curve-interpolation? = 'linear opacity : opacity? = 1/2 fill : any/c = "lightgreen" stroke : any/c = #f stroke-width : nonnegative-real? = 0
The identity, opacity, and stroke width are validated before the path Visual is created. Geometry-construction errors are reported by data-series-area-path.
For a worked composition, see Combining Plot Areas and Observations.