9.3

22 Combining Plot Areas and Observations🔗ℹ

Layer a filled function area, its graph, and observation markers in one plot.

API reference: Point Markers, Scatter Plots, and Filled Areas, Visuals.

The following example places a filled function area behind its graph and adds ordered observations as diamond markers:

(define area
  (function-area coordinate-axes
                 function
                 #:id 'area
                 #:interpolation 'smooth))
 
(define graph
  (function-graph coordinate-axes
                  function
                  #:id 'graph
                  #:interpolation 'smooth))
 
(define observations
  (scatter-plot coordinate-axes
                (list (vec2 -2 1)
                      (vec2 0 0)
                      (vec2 2 1))
                #:id 'observations
                #:shape 'diamond))

Render the canonical marker-and-area example with:

"/Applications/Racket v9.3.0.2/bin/racket" -c \

  examples/markers-scatter-areas.rkt \

  frames/markers-scatter-areas \

  markers-scatter-areas.mp4

 

open markers-scatter-areas.mp4