Download Manual

Transcript
Chapter 8: Graphs
48
;; draw the x and y axis
(graph-xaxis g)
(graph-yaxis g)
;; draw the axis labels
(graph-xlabel g "The X axis label")
(graph-ylabel g "The Y axis label")
;; show it on screen
(graph-output g GRAPH_WIN)
This produces the following graph:
> (load "~~/examples/graph-loglog")
The Y axis label
10.0
3.0
1.0
0.5
0.5
1.0
3.0
The X axis label
8.4 Example 4: 2D image graph
We can combine the graphing system with framebuffers like this:
;; examples/graph-image.scm
;; example of a 2D image graph
;; create a framebuffer with data
(define myfb (framebuffer-new 216 216))
(let loop ((x 0)(y 0))
(if (< y 216)
(let* ((newx (if (< x 215) (+ x 1) 0))
10.0