Changeset 29579 in project


Ignore:
Timestamp:
08/16/13 20:05:16 (6 years ago)
Author:
Peter Danenberg
Message:

graphviz: Update docs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/4/graphviz

    r29454 r29579  
    1010=== {{write-dot-preamble}}
    1111<procedure>(write-dot-preamble) → unspecified</procedure>
    12 <procedure>(write-dot-preamble width height font-size title) → unspecified</procedure>
     12<procedure>(write-dot-preamble width height font-size) → unspecified</procedure>
    1313Write a dot preamble.
    1414; width : Width in pixels
    1515; height : Height in pixels
    1616; font-size : Font-size in pt
    17 ; title : Title of the graph
    1817<enscript highlight="scheme">(define write-dot-preamble
    1918  (case-lambda
    2019    (()
    21      (write-dot-preamble
    22        (default-width)
    23        (default-height)
    24        (default-font-size)
    25        (default-title)))
    26     ((width height font-size title)
     20     (write-dot-preamble (default-width) (default-height) (default-font-size)))
     21    ((width height font-size)
    2722     (display "digraph G {")
    28      (display "node [style=filled, fontname=monospace, shape=circle];")
    29      (display "edge [fontname=monospace, dir=none];")
     23     (unless
     24       (null? (default-graph-attributes))
     25       (format
     26         #t
     27         "graph [~a];"
     28         (attributes->string (default-graph-attributes))))
     29     (unless
     30       (null? (default-node-attributes))
     31       (format #t "node [~a];" (attributes->string (default-node-attributes))))
     32     (unless
     33       (null? (default-edge-attributes))
     34       (format #t "edge [~a];" (attributes->string (default-edge-attributes))))
    3035     (if (and width height)
    3136       (begin
    32          (format #t "graph [fontsize=~a, ratio=fill]" font-size)
     37         (format #t "graph [fontsize=~a, ratio=fill];" font-size)
    3338         (let ((width-in-inches (px->in width))
    3439               (height-in-inches (px->in height)))
     
    4853</enscript>
    4954=== {{write-node}}
    50 <procedure>(write-node label x y color) → unspecified</procedure>
     55<procedure>(write-node label) → unspecified</procedure>
     56<procedure>(write-node label attributes) → unspecified</procedure>
    5157Write a node
    5258; label : The node's label
    53 ; x : The x-coordinate of the node
    54 ; y : The y-coordinate of the node
    55 <enscript highlight="scheme">(define (write-node label x y color)
    56   (format
    57     #t
    58     "~a [pos=\"~a,~a\", color=~a];"
    59     label
    60     (* x (linear-scale))
    61     (* y (linear-scale))
    62     color))
     59; attributes : Other attributes of the node
     60<enscript highlight="scheme">(define write-node
     61  (case-lambda
     62    ((label) (write-node label '()))
     63    ((label attributes)
     64     (format #t "~a [~a];" label (attributes->string attributes)))))
    6365</enscript>
    6466=== {{write-edge}}
    6567<procedure>(write-edge whence whither) → unspecified</procedure>
     68<procedure>(write-edge whence whither attributes) → unspecified</procedure>
    6669Write an edge
    6770; whence : The label whence
    6871; whither : The lable whither
    69 <enscript highlight="scheme">(define (write-edge whence whither) (format #t "~a -> ~a;" whence whither))
     72; attributes : Other attributes of the edge
     73<enscript highlight="scheme">(define write-edge
     74  (case-lambda
     75    ((whence whither) (write-edge whence whither '()))
     76    ((whence whither attributes) (format #t "~a -> ~a;" whence whither))))
    7077</enscript>
    7178=== About this egg
Note: See TracChangeset for help on using the changeset viewer.