Closed alex-hhh closed 1 year ago
The #marker option for function, inverse and line renderers will draw markers along the rendered plot line. The main difference between overlaying a points renderer over a function or line renderer is that legend entries show the marker as well.
function
inverse
line
points
Here is an example:
#lang racket (require plot) (plot-new-window? #t) (define (do-plot-pr118) (define-values (xdata ydata) (parameterize ([current-pseudo-random-generator (make-pseudo-random-generator)]) (random-seed 42) ; ensure our test is deterministic (define (randsin x)(+ (sin x) (/ ( - (random) 0.5) 5) ) ) (define xdata (range 0 (* 2 pi) (/ pi 9 ) ) ) (define ydata (map (lambda (x) (randsin x) ) xdata ) ) (values xdata ydata))) (parameterize ([point-size 10] [line-width 2] [plot-width 800] [plot-height 600] [point-line-width 1.5] [plot-pen-color-map 'set1] [plot-x-label #f] [plot-y-label #f]) (plot (list (function sin 0 (* 2 pi) #:label "exact" #:marker 'diamond #:color 0 #:marker-count 10) (lines (map vector xdata ydata ) #:label "discrete" #:marker 'square #:color 1 #:marker-color "black")) #:legend-anchor 'top-right #:out-file "Sample-PR118.png"))) (do-plot-pr118)
The #marker option for
function
,inverse
andline
renderers will draw markers along the rendered plot line. The main difference between overlaying apoints
renderer over afunction
orline
renderer is that legend entries show the marker as well.Here is an example: