def write_tree(tree, w, h, suffix='', scale=1.0): w += PAD_X * 2 h += PAD_Y * 2 if suffix: suffix = '-' + suffix init_surface(w, h, suffix=suffix, scale=scale) ctx.translate(PAD_X, PAD_Y) tree.draw() ctx.writesurface()
from twyg.cairowrapper import context as ctx config1 = r""" [layout] style layout [node] style line fontName $FONTNAME fontSize $FONTSIZE textBaselineCorrection $BASELINE_CORR strokeWidth 4 [connection] style curve [color] style cycle colorscheme "mint-examples2" """ data1 = {'daffadowndilly': []} init_surface(160, 50, scale=0.9) ctx.translate(3, 3) tree = create_tree(config1, data1) tree.draw() ctx.writesurface()
cornerStyle square junctionStyle none junctionRadius 10 junctionXFactor 0.55 [color] style cycle colorscheme "mint-examples3" """ data1 = { 'barrel': ['flank', 'stem', 'grot']} data2 = { 'barrel': ['flank', 'stem', 'grot']} data3 = { '7381': ['331', '102', '445', '983']} init_surface(865, 165, scale=0.75) tree1 = create_tree(config1, data1) tree2 = create_tree(config2, data2) tree3 = create_tree(config3, data3) ctx.translate(3, 3) tree1.draw() ctx.translate(310, 0) tree2.draw() ctx.translate(310, 0) tree3.draw() ctx.writesurface()
[color] style cycle colorscheme "mint-examples3" fontColorAuto no fontColor #fff fillColor baseColor.blend(#fff, .45) """ data1 = {'lob': []} data2 = {'boon': []} data3 = {'mew': []} tree1 = create_tree(config1, data1) tree2 = create_tree(config2, data2) tree3 = create_tree(config3, data3) init_surface(340, 100, scale=0.9) ctx.translate(3, 15) tree1.draw() ctx.translate(120, -6) tree2.draw() ctx.translate(130, 3) tree3.draw() ctx.writesurface()
[color] style cycle colorscheme "mint-examples3" fontColorAuto no fontColor #fff fillColor baseColor.blend(#fff, .45) """ data1 = { 'mar': [] } data2 = { 'ere': [] } data3 = { 'amiss': [] } tree1 = create_tree(config1, data1) tree2 = create_tree(config2, data2) tree3 = create_tree(config3, data3) init_surface(320, 83, scale=0.9) ctx.translate(3, 3) tree1.draw() ctx.translate(120, 4) tree2.draw() ctx.translate(100, 9) tree3.draw() ctx.writesurface()
cornerStyle square junctionStyle none junctionRadius 10 junctionXFactor 0.55 [color] style cycle colorscheme "mint-examples3" """ data1 = {'barrel': ['flank', 'stem', 'grot']} data2 = {'barrel': ['flank', 'stem', 'grot']} data3 = {'7381': ['331', '102', '445', '983']} init_surface(865, 165, scale=0.75) tree1 = create_tree(config1, data1) tree2 = create_tree(config2, data2) tree3 = create_tree(config3, data3) ctx.translate(3, 3) tree1.draw() ctx.translate(310, 0) tree2.draw() ctx.translate(310, 0) tree3.draw() ctx.writesurface()
style curve [color] style cycle colorscheme "mint-examples3" fillColor baseColor.blend(#fff, .8) """ data1 = { 'mischance': [] } data2 = { 'succour': [] } data3 = { 'trapessing': [] } tree1 = create_tree(config1, data1) tree2 = create_tree(config2, data2) tree3 = create_tree(config3, data3) init_surface(425, 45, scale=0.9) ctx.translate(3, 3) tree1.draw() ctx.translate(165, 0) tree2.draw() ctx.translate(135, 0) tree3.draw() ctx.writesurface()
[color] style cycle colorscheme "mint-examples" fontColorAuto no fontColor baseColor fillColor rgba(0, 0, 0, 0) """ data1 = {"unblazoned": []} data2 = {"varmint": []} data3 = {"wheedle": []} tree1 = create_tree(config1, data1) tree2 = create_tree(config2, data2) tree3 = create_tree(config3, data3) init_surface(445, 65, scale=0.9) ctx.translate(3, 3) tree1.draw() ctx.translate(172, 0) tree2.draw() ctx.translate(140, 0) tree3.draw() ctx.writesurface()
config1 = r""" [layout] style layout [node] style line fontName $FONTNAME fontSize $FONTSIZE textBaselineCorrection $BASELINE_CORR strokeWidth 4 [connection] style curve [color] style cycle colorscheme "mint-examples2" """ data1 = { 'daffadowndilly': [] } init_surface(160, 50, scale=0.9) ctx.translate(3, 3) tree = create_tree(config1, data1) tree.draw() ctx.writesurface()
style curve [color] style cycle colorscheme "mint-examples" fontColorAuto no fontColor baseColor fillColor rgba(0, 0, 0, 0) """ data1 = {'unblazoned': []} data2 = {'varmint': []} data3 = {'wheedle': []} tree1 = create_tree(config1, data1) tree2 = create_tree(config2, data2) tree3 = create_tree(config3, data3) init_surface(445, 65, scale=0.9) ctx.translate(3, 3) tree1.draw() ctx.translate(172, 0) tree2.draw() ctx.translate(140, 0) tree3.draw() ctx.writesurface()
[color] style cycle colorscheme "mint-examples3" fontColorAuto no fontColor #fff fillColor baseColor.blend(#fff, .45) """ data1 = {'mar': []} data2 = {'ere': []} data3 = {'amiss': []} tree1 = create_tree(config1, data1) tree2 = create_tree(config2, data2) tree3 = create_tree(config3, data3) init_surface(320, 83, scale=0.9) ctx.translate(3, 3) tree1.draw() ctx.translate(120, 4) tree2.draw() ctx.translate(100, 9) tree3.draw() ctx.writesurface()
[color] style cycle colorscheme "mint-examples3" fontColorAuto no fontColor #fff fillColor baseColor.blend(#fff, .45) """ data1 = { 'lob': [] } data2 = { 'boon': [] } data3 = { 'mew': [] } tree1 = create_tree(config1, data1) tree2 = create_tree(config2, data2) tree3 = create_tree(config3, data3) init_surface(390, 110, scale=0.8) ctx.translate(0, 15) tree1.draw() ctx.translate(136, -6) tree2.draw() ctx.translate(150, 3) tree3.draw() ctx.writesurface()
[color] style cycle colorscheme "mint-examples3" fontColorAuto no fontColor #fff fillColor baseColor.blend(#fff, .45) """ data1 = { 'lob': [] } data2 = { 'boon': [] } data3 = { 'mew': [] } tree1 = create_tree(config1, data1) tree2 = create_tree(config2, data2) tree3 = create_tree(config3, data3) init_surface(340, 100, scale=0.9) ctx.translate(3, 15) tree1.draw() ctx.translate(120, -6) tree2.draw() ctx.translate(130, 3) tree3.draw() ctx.writesurface()
[connection] style curve [color] style cycle colorscheme "mint-examples3" fillColor baseColor.blend(#fff, .8) """ data1 = {'mischance': []} data2 = {'succour': []} data3 = {'trapessing': []} tree1 = create_tree(config1, data1) tree2 = create_tree(config2, data2) tree3 = create_tree(config3, data3) init_surface(425, 45, scale=0.9) ctx.translate(3, 3) tree1.draw() ctx.translate(165, 0) tree2.draw() ctx.translate(135, 0) tree3.draw() ctx.writesurface()
[color] style cycle colorscheme "mint-examples3" fontColorAuto no fontColor #fff fillColor baseColor.blend(#fff, .45) """ data1 = {'lob': []} data2 = {'boon': []} data3 = {'mew': []} tree1 = create_tree(config1, data1) tree2 = create_tree(config2, data2) tree3 = create_tree(config3, data3) init_surface(390, 110, scale=0.8) ctx.translate(0, 15) tree1.draw() ctx.translate(136, -6) tree2.draw() ctx.translate(150, 3) tree3.draw() ctx.writesurface()