I'm trying to use the lines function to plot a graph, but I can't seem to figure out the exact syntax. Here's some code I tried:
(require plot)
(define lst '(1 2 3 4 5 6 7 8 9))
(define f (plot-frame (lines lst)))
(send f show #t)
But it gives me the following error message:
lines: contract violation
expected: sequence of length >= 2
given: #<sequence>
The lines
function's first argument is supposed to be a sequence of sequences of real numbers (as opposed to just a sequence of real numbers). That's what this contract shown in the documentation means: (sequence/c (sequence/c real?))
For example, this is a valid input: (lines '((1 2) (3 4)))
There's also a full example in the docs: http://www.cs.utah.edu/plt/snapshots/current/doc/plot/renderer2d.html?q=lines#%28def._%28%28lib._plot%2Fmain..rkt%29._lines%29%29
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.