; ;****************************************************** ; ; basic functional plot. ; ; ena - 3/7/2000. ; ;****************************************************** ; (provide "functional-plot") ; (defun line-plot (data title) (let* ( (add-mean (yes-or-no-dialog "Display mean curve?")) (plot (send graph-proto :new 2 :title title)) ) (defmeth plot :plot-mean (data-sel) (let* ( (data-trans (transpose data-sel)) (freq (first data-trans)) (inten (second data-trans)) (mean-freq (mapcar #'mean (transpose freq))) (mean-inten (mapcar #'mean (transpose inten))) (num-lines (length freq)) (num-points (length (first freq))) (seq (+ (* num-lines num-points) (iseq num-points))) ) (send self :add-lines (list mean-freq mean-inten)) (send self :linestart-color seq 'red) (send self :linestart-width seq 2) (send self :redraw) ) ) (defmeth plot :draw-lines () (let* ( (data-sel (select data *current-points*)) ) (send self :clear) (mapcar #'(lambda (x) (send self :add-lines x)) data-sel) (if add-mean (send self :plot-mean data-sel)) ) ) (defmeth plot :remove () (setf *line-plots* (set-difference *line-plots* (list self))) (call-next-method) ) (setf *current-points* (iseq (length data))) (send plot :use-color T) (send plot :draw-lines) (send plot :x-axis T nil 4) (send plot :y-axis T nil 4) (send plot :adjust-to-data) (setf *line-plots* (cons plot *line-plots*)) plot ) )