▼V Reference
52 Find a task or a name
53 Modules to require
54 Scenes and sampling
55 Scene states
56 Animation requests
57 Native model details
58 Visuals
59 Geometry
60 Number Lines and Coordinate Decorations
61 Point Markers, Scatter Plots, and Filled Areas
62 Probability and Statistical Diagrams
63 Calculus lessons
64 Colors
65 Slides
66 Slide command-line tools
67 Source Programs and Authored Timelines
68 Interactive Preview and Inspection
69 Preview controls and diagnostics
70 Projects and Final Rendering
71 Project execution and cache details
72 Pict Renderer Protocol
73 3D reference map
74 3D:   Objects, groups, and paths
75 3D:   Cameras and projection
76 3D:   Views inside a Scene
77 3D:   Animating 3D objects
78 3D:   Animating the 3D camera
79 3D:   Cuts, caps, and section measurements
80 3D:   Supplementary surface, section, and annotation bindings
81 3D:   Cuts, sections, and numerical volume
82 3D:   Vectors
83 3D:   Linear maps and rotations
84 3D:   Affine transforms
85 3D:   Bounds, rays, and planes
86 3D:   Spatial maps and homotopies
87 3D:   Materials and lights
88 3D:   Lighting inspection
89 3D:   Shadow descriptors and stable bounds
90 3D:   Finite-light animation
91 3D:   Software finite-light evaluation
92 3D:   Colour space and final output
93 3D:   Relations and geometric annotations
94 3D:   Projected labels
95 3D:   Textured billboards
96 3D:   Spatial curves and vector diagrams
97 3D:   Spatial anchors and label layout
98 3D:   Anchors and projected labels
99 3D:   Parametric surfaces and calculus
100 3D:   Adaptive, trimmed, and implicit surfaces
101 3D:   Constructive solids
102 3D:   Surface constructors and queries
103 3D:   Meshes
104 3D:   Triangle topology
105 3D:   Polygonal faces
106 3D:   Deterministic convex hulls
107 3D:   Polyhedral duals
108 3D:   Schlegel diagrams and polyhedral nets
109 3D:   Conservative mesh correspondence
110 3D:   Topology-safe mesh matching
111 3D:   Checking and repairing mesh orientation
112 3D:   Clipping, sections, and transparency
113 3D:   Prepared spatial ODE trajectories and vector fields
114 3D:   Seeds and streamline sets
115 3D:   Poincare sections and return maps
116 3D:   Equilibria and local linearization
117 3D:   Flow maps and volume change
118 3D:   Drawing and inspecting trajectories
119 3D:   Reading prepared trajectories
120 3D:   Drawing vector fields and particles
121 3D:   Trajectory display
122 3D:   Spatial inspection and exact picking
123 3D:   Retained renderer backends
124 3D:   Compiled geometry and instances
125 3D:   Frame requests and results
126 3D:   Software rendering and statistics
127 3D:   Optional Racket/  Open  GL backend
128 Experimental Derived Visuals
129 Source Package Hygiene
On this page:
bar-chart
histogram
stacked-bar-chart
sample-space
probability-branch
probability-tree
box-plot
error-bar-point
error-bars
bar-chart-bar-path
stacked-bar-path
stacked-bar-segment-path
sample-space-cell-path
probability-tree-node-path
box-plot-summary
error-bar-path
9.3

62 Probability and Statistical Diagrams🔗ℹ

Small, immutable, addressable diagram groups support common probability and statistics explanations. These constructors do not analyse data or add a separate scene protocol: their bars, cells, tree branches, quartile box, and error-bar elements are ordinary named children that work with existing paths, colours, transforms, and attention effects.

procedure

(bar-chart values    
  #:id identifier    
  [#:labels labels    
  #:center center    
  #:width width    
  #:height height    
  #:maximum maximum    
  #:fill fill    
  #:stroke stroke    
  #:stroke-width stroke-width    
  #:value-labels? value-labels?]) → group-visual?
  values : (and/c list? pair?)
  identifier : symbol?
  labels : (or/c (listof string?) false/c) = #f
  center : vec2? = origin
  width : positive-real? = 6
  height : positive-real? = 3
  maximum : (or/c positive-real? false/c) = #f
  fill : any/c = "cornflowerblue"
  stroke : any/c = "navy"
  stroke-width : nonnegative-real? = 2
  value-labels? : boolean? = #t
Creates a baseline and one upward nonnegative bar per value. Values are scaled against maximum, or the largest supplied value (at least one). Labels and value labels are optional ordinary text children. The path of one bar is (bar-chart-bar-path identifier index), where indexes start at one.

procedure

(histogram samples    
  #:id identifier    
  [#:bins bins    
  #:range range    
  #:center center    
  #:width width    
  #:height height]) → group-visual?
  samples : (and/c list? pair?)
  identifier : symbol?
  bins : exact-positive-integer? = 8
  range : (or/c pair? false/c) = #f
  center : vec2? = origin
  width : positive-real? = 6
  height : positive-real? = 3
Counts finite numeric samples into equally wide bins, then returns the same addressable bar-group shape as bar-chart. A supplied range is an increasing pair; samples outside it are omitted and a sample at the upper bound belongs to the final bin.

procedure

(stacked-bar-chart rows    
  #:id identifier    
  [#:center center    
  #:width width    
  #:height height    
  #:maximum maximum    
  #:colors colors    
  #:stroke stroke    
  #:stroke-width stroke-width]) → group-visual?
  rows : (and/c list? pair?)
  identifier : symbol?
  center : vec2? = origin
  width : positive-real? = 6
  height : positive-real? = 3
  maximum : (or/c positive-real? false/c) = #f
  colors : (and/c list? pair?) = any/c
  stroke : any/c = "navy"
  stroke-width : nonnegative-real? = 1
Creates one bar per equal-length nonnegative row and stacks each row’s values from the common baseline. Use stacked-bar-path and stacked-bar-segment-path for one bar or segment, with one-based indexes.

procedure

(sample-space rows    
  #:id identifier    
  [#:center center    
  #:width width    
  #:height height]) → group-visual?
  rows : (and/c list? pair?)
  identifier : symbol?
  center : vec2? = origin
  width : positive-real? = 5
  height : positive-real? = 3
Creates equally sized, coloured cells from a nonnegative rectangular matrix. Each cell displays its supplied weight. Its path is (sample-space-cell-path identifier row column), with one-based row and column indexes; the geometry remains equal even for unequal weights.

struct

(struct probability-branch (id label probability children)
    #:transparent)
  id : symbol?
  label : string?
  probability : nonnegative-real?
  children : (listof probability-branch?)
Describes one immutable node in a finite probability tree. Branch identities must be globally unique within one probability-tree input.

procedure

(probability-tree branches    
  #:id identifier    
  [#:center center    
  #:width width    
  #:level-gap gap    
  #:node-radius radius]) → group-visual?
  branches : (and/c list? pair?)
  identifier : symbol?
  center : vec2? = origin
  width : positive-real? = 6
  gap : positive-real? = 1
  radius : positive-real? = 1/6
Lays out an explicit finite forest by leaf order. Child edge labels display the child branch probability. A node can be addressed with (probability-tree-node-path identifier branch-id).

procedure

(box-plot values    
  #:id identifier    
  [#:center center    
  #:width width    
  #:height height]) → group-visual?
  values : (listof finite-real?)
  identifier : symbol?
  center : vec2? = origin
  width : positive-real? = 5
  height : positive-real? = 3/4
Creates whiskers, a quartile box, and a median line from at least two values. Quartiles use deterministic linear interpolation between sorted observations; outliers are not inferred or displayed. box-plot-summary is the transparent five-number summary structure used by the constructor.

struct

(struct error-bar-point (x y error)
    #:transparent)
  x : finite-real?
  y : finite-real?
  error : nonnegative-real?
Describes a point with symmetric vertical error.

procedure

(error-bars points    
  #:id identifier    
  [#:center center    
  #:cap-width cap-width]) → group-visual?
  points : (and/c list? pair?)
  identifier : symbol?
  center : vec2? = origin
  cap-width : positive-real? = 1/5
Creates addressable vertical stems, end caps, and point markers. The path for a one-based point index is (error-bar-path identifier index).

procedure

(bar-chart-bar-path identifier index) → visual-path?

  identifier : symbol?
  index : exact-positive-integer?
Returns the path of one one-based bar.

procedure

(stacked-bar-path identifier index) → visual-path?

  identifier : symbol?
  index : exact-positive-integer?
Returns the path of one one-based stacked bar.

procedure

(stacked-bar-segment-path identifier    
  bar-index    
  segment-index) → visual-path?
  identifier : symbol?
  bar-index : exact-positive-integer?
  segment-index : exact-positive-integer?
Returns the path of one one-based stacked-bar segment.

procedure

(sample-space-cell-path identifier    
  row    
  column) → visual-path?
  identifier : symbol?
  row : exact-positive-integer?
  column : exact-positive-integer?
Returns the path of one one-based sample-space cell.

procedure

(probability-tree-node-path identifier    
  branch-id) → visual-path?
  identifier : symbol?
  branch-id : symbol?
Returns the path of one named probability-tree node.

struct

(struct box-plot-summary (minimum
    lower-quartile
    median
    upper-quartile
    maximum)
    #:transparent)
  minimum : finite-real?
  lower-quartile : finite-real?
  median : finite-real?
  upper-quartile : finite-real?
  maximum : finite-real?
The deterministic five-number summary used by box-plot.

procedure

(error-bar-path identifier index) → visual-path?

  identifier : symbol?
  index : exact-positive-integer?
Returns the path of one one-based error-bar group.

See "examples/probability-and-statistics.rkt" for one composition that uses chart, finite-outcome, tree, distribution, and uncertainty views together. }

Reference · Visuals