glgui recurrence - part-cw/lambdanative GitHub Wiki
(glgui-recurrence g x y w h data color . bgcolor)
glgui-recurrence adds a recurrence plot to the screen.
Parameter | Description |
---|---|
g | The Graphical User Interface (GUI) this widget belongs to |
x | Lower left corner along the x-axis in pixels |
y | Lower left corner along the y-axis in pixels |
w | Width of the widget in pixels |
h | Height of the widget in pixels |
data | List (or list of two lists) of data to be plotted |
color | Colormap to be used (GRADIENT_THERMAL if White, GRADIENT_GRAY otherwise) |
bgcolor | Optional: The widget background color |
Example
Example 1: Draw a simple recurrence plot for 200msec of a 8Hz signal.
(set! gui:main (make-glgui))
(define pi (* (atan 1) 4))
(define data (let loop ((i 0) (ret '()))
(if (fx= i 100)
ret
(loop (fx+ i 1) (append ret (list (sin (/ (* 2 pi 8 i) 1000))))))
))
(glgui-recurrence gui 100 100 200 200 data White))
Example 2: Show the recurrance plot for two signals: 7Hz and 7+35 Hz.
(set! gui:main (make-glgui))
(define pi (* (atan 1) 4))
(define data1 (let loop ((i 0) (ret '()))
(if (fx= i 300)
ret (loop (fx+ i 1)
(append ret (list (sin (/ (* 2 pi 7 i) 1000))))))
))
(define data2 (let loop ((i 0) (ret '()))
(if (fx= i 300)
ret
(loop (fx+ i 1) (append ret (list (+ (list-ref data1 i)
(sin (/ (* 2 pi 35 i) 1000)))))))
))
(define data (list data1 data2))
(glgui-recurrence gui 0 0 300 300 data Red Blue))
Attributes
Besides the parameters set in the above procedure, the widget has the following attributes that can be set using glgui-widget-set! and retrieved using glgui-widget-get:
Attribute | Default Value | Description |
---|---|---|
gradient | (if (= color White) GRADIENT_THERMAL GRADIENT_GRAY) | Colorspace used for plotting |