Created
March 18, 2014 15:36
-
-
Save jonashaag/9622563 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.Tree | |
import Diagrams.Prelude | |
import Diagrams.TwoD.Layout.Tree | |
import Diagrams.Backend.SVG.CmdLine | |
t1 = Node 'A' [Node 'B' (map lf "CDE"), Node 'F' [Node 'G' (map lf "HIJ")]] | |
where lf x = Node x [] | |
exampleSymmTree :: Diagram B R2 | |
exampleSymmTree = foldl1 (|||) (map renderWithSep [0.5..5]) | |
where renderWithSep sep = renderTree ((<> circle 1 # fc white) . text . (:[])) | |
(~~) | |
(symmLayout' (with & slHSep .~ sep & slVSep .~ sep) t1) | |
# lw 0.03 | |
# centerXY # pad 1.1 | |
main = mainWith exampleSymmTree |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.Tree | |
import Diagrams.Prelude | |
import Diagrams.TwoD.Layout.Tree | |
import Diagrams.Backend.SVG.CmdLine | |
t1 = Node 'A' [Node 'B' (map lf "CDE"), Node 'F' [Node 'G' (map lf "HIJ")]] | |
where lf x = Node x [] | |
exampleSymmTree :: Diagram B R2 | |
exampleSymmTree = foldl1 (|||) (map renderWithSep [0.5..5]) | |
where renderWithSep sep = renderTree ((<> circle 1 # fc white) . text . (:[])) | |
(~~) | |
(symmLayout' (with & slHSep .~ sep & slVSep .~ sep) t1) | |
# lw 0.03 | |
# centerXY # pad 1.1 | |
=== text (show sep) # scale 2 | |
main = mainWith exampleSymmTree |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.Tree | |
import Diagrams.Prelude | |
import Diagrams.TwoD.Layout.Tree | |
import Diagrams.Backend.SVG.CmdLine | |
t1 = Node 'A' [Node 'B' (map lf "CDE"), Node 'F' [Node 'G' (map lf "HIJ")]] | |
where lf x = Node x [] | |
exampleSymmTree :: Diagram B R2 | |
exampleSymmTree = foldl1 (|||) (map renderWithSep [0.5..5]) | |
where renderWithSep sep = text (show sep) # scale 2 | |
=== renderTree ((<> circle 1 # fc white) . text . (:[])) | |
(~~) | |
(symmLayout' (with & slHSep .~ sep & slVSep .~ sep) t1) | |
# lw 0.03 | |
# centerXY # pad 1.1 | |
main = mainWith exampleSymmTree |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment