▼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:
number-line
number-line-visual?
number-line-visual-range
number-line-visual-length
number-line-visual-stroke
number-line-visual-stroke-width
number-line-visual-tick-size
number-line-visual-tip-length
number-line-visual-tip-width
number-line-visual-start-tip?
number-line-visual-end-tip?
number-line-unit-length
number-line-tick-values
number-line-number->point
number-line-point->number
number-line-visual-start
number-line-visual-end
axes-grid-lines
axes-number-labels
number-line-number-labels
9.3

60 Number Lines and Coordinate Decorations🔗ℹ

Number-line Visuals and coordinate-decoration constructors provide grid lines and upright numeric labels derived from an existing coordinate object. These constructors produce immutable snapshots. Changing the source axes or number line later does not update an already constructed grid or label list.

procedure

(number-line range    
  #:id identifier    
  [#:center center    
  #:rotation rotation    
  #:scale scale    
  #:opacity opacity    
  #:length length    
  #:stroke stroke    
  #:stroke-width stroke-width    
  #:tick-size tick-size    
  #:tip-length tip-length    
  #:tip-width tip-width    
  #:start-tip? start-tip?    
  #:end-tip? end-tip?]) → number-line-visual?
  range : axis-range?
  identifier : symbol?
  center : vec2? = origin
  rotation : finite-real? = 0
  scale : any/c = 1
  opacity : opacity? = 1
  length : positive-real? = 10
  stroke : string? = "black"
  stroke-width : nonnegative-real? = 2
  tick-size : nonnegative-real? = 1/5
  tip-length : nonnegative-real? = 2/5
  tip-width : nonnegative-real? = 3/10
  start-tip? : boolean? = #f
  end-tip? : boolean? = #f
Constructs a horizontal semantic number line. range must contain zero. The Visual’s reference position is the point representing numeric zero, not necessarily the geometric midpoint of the shaft. length is the local world-unit length of the complete interval.

The regular ticks come from axis-range-tick-values, with zero inserted for the number-line representation. Stroke width is cosmetic. Tick and tip sizes are semantic local geometry and therefore follow affine scale.

procedure

(number-line-visual? value) → boolean?

  value : any/c
Returns #t when value is a number-line Visual.

procedure

(number-line-visual-range visual) → axis-range?

  visual : number-line-visual?
Returns the numeric range and regular tick step.

procedure

(number-line-visual-length visual) → positive-real?

  visual : number-line-visual?
Returns the local shaft length for the complete numeric interval.

procedure

(number-line-visual-stroke visual) → string?

  visual : number-line-visual?
Returns the shaft, tick, and tip color name.

procedure

(number-line-visual-stroke-width visual) → nonnegative-real?

  visual : number-line-visual?
Returns the cosmetic stroke width.

procedure

(number-line-visual-tick-size visual) → nonnegative-real?

  visual : number-line-visual?
Returns the full local length of every regular tick.

procedure

(number-line-visual-tip-length visual) → nonnegative-real?

  visual : number-line-visual?
Returns the local length of each enabled triangular tip.

procedure

(number-line-visual-tip-width visual) → nonnegative-real?

  visual : number-line-visual?
Returns the full local width of each enabled triangular tip.

procedure

(number-line-visual-start-tip? visual) → boolean?

  visual : number-line-visual?
Reports whether the minimum endpoint has a tip.

procedure

(number-line-visual-end-tip? visual) → boolean?

  visual : number-line-visual?
Reports whether the maximum endpoint has a tip.

procedure

(number-line-unit-length visual) → positive-real?

  visual : number-line-visual?
Returns the local world-unit distance representing one numeric unit.

procedure

(number-line-tick-values visual 
  [#:include-zero? include-zero?]) 
 → (listof finite-real?)
  visual : number-line-visual?
  include-zero? : boolean? = #t
Returns regular tick values in increasing numeric order. Zero is included by default and can be omitted explicitly.

procedure

(number-line-number->point visual number) → vec2?

  visual : number-line-visual?
  number : finite-real?
Maps number to the containing coordinate system. The result includes the number line’s complete translation, rotation, and scale. Values outside the visible range are extrapolated.

procedure

(number-line-point->number visual point) → real?

  visual : number-line-visual?
  point : vec2?
Projects point onto the transformed number line and returns the corresponding numeric value. A point need not lie exactly on the line.

procedure

(number-line-visual-start visual) → vec2?

  visual : number-line-visual?
Returns the transformed point at the numeric minimum.

procedure

(number-line-visual-end visual) → vec2?

  visual : number-line-visual?
Returns the transformed point at the numeric maximum.

procedure

(axes-grid-lines axes    
  #:id identifier    
  [#:x-grid? x-grid?    
  #:y-grid? y-grid?    
  #:include-zero? include-zero?    
  #:opacity opacity    
  #:stroke stroke    
  #:stroke-width stroke-width]) → path-visual?
  axes : axes-visual?
  identifier : symbol?
  x-grid? : boolean? = #t
  y-grid? : boolean? = #t
  include-zero? : boolean? = #f
  opacity : opacity? = 1
  stroke : string? = "lightgray"
  stroke-width : nonnegative-real? = 1
Constructs an ordinary path Visual containing vertical grid lines at x ticks and horizontal grid lines at y ticks. X lines precede y lines in traversal order. Zero is omitted by default because the axes already draw the coordinate axes there. The returned path copies the current axes transform.

procedure

(axes-number-labels axes 
  #:id-prefix identifier-prefix 
  [#:include-zero? include-zero? 
  #:font-size font-size 
  #:color color 
  #:x-gap x-gap 
  #:y-gap y-gap 
  #:number->string number->string]) 
 → (listof text-visual?)
  axes : axes-visual?
  identifier-prefix : symbol?
  include-zero? : boolean? = #f
  font-size : positive-real? = 3/10
  color : string? = "black"
  x-gap : nonnegative-real? = 1/10
  y-gap : nonnegative-real? = 1/10
  number->string : procedure? = number->string
Constructs upright plain-text labels at the current tick positions. X labels come first in increasing value order, followed by y labels. When zero is included, it appears once among the x labels; it is not duplicated on the y axis. The x gap and y gap are semantic distances from the corresponding tick extent to the label anchor.

The formatter is called once per label with the numeric value. It must accept one argument and return exactly one string. It is not retained in the returned Visuals. Child identities have the forms prefix-x-index and prefix-y-index, where each index starts at zero.

procedure

(number-line-number-labels number-line 
  #:id-prefix identifier-prefix 
  [#:include-zero? include-zero? 
  #:font-size font-size 
  #:color color 
  #:gap gap 
  #:number->string number->string]) 
 → (listof text-visual?)
  number-line : number-line-visual?
  identifier-prefix : symbol?
  include-zero? : boolean? = #t
  font-size : positive-real? = 3/10
  color : string? = "black"
  gap : nonnegative-real? = 1/10
  number->string : procedure? = number->string
Constructs upright plain-text labels below the current number-line ticks. Values and result order are those of number-line-tick-values. Child identities have the form prefix-number-index. The formatter contract is the same as for axes-number-labels.

Number-line rendering is implemented by converting the model to ordinary semantic path geometry after explicit renderer selection. A custom renderer can therefore override the complete number line. Semantic opacity is applied once after either custom rendering or fallback conversion. Grid lines use the normal path renderer, while labels use the normal plain-text renderer.

Reference · Visuals