anchor.diff:  (defun thin (n l)
     (loop for i from 0 to (1- (length l)) by (ceiling (/ (length l) n)) collect (nth i l)))
   
  -(defun plot-xy (xvals yvals &key (aspect 1.0) (background (list 0.2 0.2 0.2)) (palette '((1.0 0.2 0.2) (0.2 1.0 0.2) (0.2 0.2 1.0)))
  +(defun plot/xy (xvals yvals &key (aspect 1.0) (background (list 0.2 0.2 0.2)) (palette '((1.0 0.2 0.2) (0.2 1.0 0.2) (0.2 0.2 1.0)))
                        (legend nil) (labels nil) (width 800) (filename "plot2d.pdf") (format :pdf))
     (let* ((xvals (if (listp (car xvals)) xvals (list xvals)))
            (yvals (if (listp (car yvals)) yvals (list yvals)))
  
positive.code:   (:use :common-lisp
          :cairo)
    (:export :plot
             :plot-xy))
  
  (in-package :plot2d)
  
  
negative.code:         (let ((bz 30)
                (bg (append (mapcar #'(lambda (x) (- 1.0 x)) background) '(0.8))))
            (destructuring-bind (xb yb w h) (max-extents legend)
              (let ((h (+ 5 h)))
                (apply #'set-source-rgba bg)
                (rectangle (+ bz bx -5 xb) (+ yb by bz -5) (+ w 75) (+ 10 (* h (length legend))))
                (fill-path)
                (loop for txt in legend
                   for c in colors
                   as y = (+ bz by) then (+ y h) do
                     (apply #'set-source-rgb background)
                     (move-to (+ bx bz) y)
                     (show-text txt)
                     (move-to (+ bx bz 5 w xb) (+ (/ yb 2) y))
                     (apply #'set-source-rgb c)
                     (line-to (+ bx bz 65 w xb) (+ (/ yb 2) y))
                     (stroke)))))))
                  
      (destroy *context*)))
  
  