Some examples¶
This file gathers some basic examples to get started with 🌿 pytreesvg.
A basic binary tree in three different versions¶
Let’s draw a basic binary tree while comparing the basic parameters of pytreesvg.node_svg.NodeSVG.to_svg()
:
from pytreesvg.node_svg import NodeSVG, NodeStyle
tree = NodeSVG(1, children=[NodeSVG(2), NodeSVG(3, style='red@12')])
tree.to_svg('source/_static/example_1.1.svg', gradient_color=False, image_border=True)
tree.to_svg('source/_static/example_1.2.svg', gradient_color=False, image_border=False)
tree.to_svg('source/_static/example_1.3.svg', gradient_color=True, image_border=False)
You can take a quick look at the content of the .svg
file created for the third figure (example_1.3.svg
):
See example_1.3.svg
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<svg width="400" height="400" version="1.1" xmlns="http://www.w3.org/2000/svg">
<!-- image title -->
<title>Tree graphic created with pytreesvg</title>
<defs>
<!-- linear gradient definitions -->
<linearGradient id="grad_blue_red" x1="0%" x2="0%" y1="0%" y2="100%">
<stop offset="0%" stop-color="blue"/>
<stop offset="100%" stop-color="red"/>
</linearGradient>
</defs>
<!-- Node 1 -->
<line x1="200.0" y1="100.0" x2="100.0" y2="300.0" stroke="blue" stroke-width="2"/> <!-- edge to node 2 -->
<line x1="200.0" y1="100.0" x2="300.0" y2="300.0" stroke="url(#grad_blue_red)" stroke-width="2"/> <!-- edge to node 3 -->
<circle cx="200.0" cy="100.0" r="12" fill="blue"/>
<!-- Node 2 -->
<circle cx="100.0" cy="300.0" r="12" fill="blue"/>
<!-- Node 3 -->
<circle cx="300.0" cy="300.0" r="12" fill="red"/>
</svg>
Let’s add some colors!¶
Here is a more complex tree:
from pytreesvg.node_svg import NodeSVG, NodeStyle
tree = NodeSVG('-', children=[NodeSVG(1),
NodeSVG('*',
style='red@20',
children=[NodeSVG('+',
style='green@16',
children=[NodeSVG(1),
NodeSVG(2),
NodeSVG(3),
NodeSVG(4)]),
NodeSVG(18)])])
for child in tree.children[1].children[0].children:
child.style = NodeStyle('purple@8')
tree.to_svg('source/_static/example_2.svg', width=600, height=600, gradient_color=True, image_border=False)
And the created .svg
file looks like:
See example_2.svg
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<svg width="600" height="600" version="1.1" xmlns="http://www.w3.org/2000/svg">
<!-- image title -->
<title>Tree graphic created with pytreesvg</title>
<defs>
<!-- linear gradient definitions -->
<linearGradient id="grad_blue_red" x1="0%" x2="0%" y1="0%" y2="100%">
<stop offset="0%" stop-color="blue"/>
<stop offset="100%" stop-color="red"/>
</linearGradient>
<linearGradient id="grad_red_green" x1="0%" x2="0%" y1="0%" y2="100%">
<stop offset="0%" stop-color="red"/>
<stop offset="100%" stop-color="green"/>
</linearGradient>
<linearGradient id="grad_green_purple" x1="0%" x2="0%" y1="0%" y2="100%">
<stop offset="0%" stop-color="green"/>
<stop offset="100%" stop-color="purple"/>
</linearGradient>
<linearGradient id="grad_red_blue" x1="0%" x2="0%" y1="0%" y2="100%">
<stop offset="0%" stop-color="red"/>
<stop offset="100%" stop-color="blue"/>
</linearGradient>
</defs>
<!-- Node '-' -->
<line x1="300.0" y1="75.0" x2="150.0" y2="225.0" stroke="blue" stroke-width="2"/> <!-- edge to node 1 -->
<line x1="300.0" y1="75.0" x2="450.0" y2="225.0" stroke="url(#grad_blue_red)" stroke-width="2"/> <!-- edge to node '*' -->
<circle cx="300.0" cy="75.0" r="12" fill="blue"/>
<!-- Node 1 -->
<circle cx="150.0" cy="225.0" r="12" fill="blue"/>
<!-- Node '*' -->
<line x1="450.0" y1="225.0" x2="375.0" y2="375.0" stroke="url(#grad_red_green)" stroke-width="2"/> <!-- edge to node '+' -->
<line x1="450.0" y1="225.0" x2="525.0" y2="375.0" stroke="url(#grad_red_blue)" stroke-width="2"/> <!-- edge to node 18 -->
<circle cx="450.0" cy="225.0" r="20" fill="red"/>
<!-- Node '+' -->
<line x1="375.0" y1="375.0" x2="318.75" y2="525.0" stroke="url(#grad_green_purple)" stroke-width="2"/> <!-- edge to node 1 -->
<line x1="375.0" y1="375.0" x2="356.25" y2="525.0" stroke="url(#grad_green_purple)" stroke-width="2"/> <!-- edge to node 2 -->
<line x1="375.0" y1="375.0" x2="393.75" y2="525.0" stroke="url(#grad_green_purple)" stroke-width="2"/> <!-- edge to node 3 -->
<line x1="375.0" y1="375.0" x2="431.25" y2="525.0" stroke="url(#grad_green_purple)" stroke-width="2"/> <!-- edge to node 4 -->
<circle cx="375.0" cy="375.0" r="16" fill="green"/>
<!-- Node 1 -->
<circle cx="318.75" cy="525.0" r="8" fill="purple"/>
<!-- Node 2 -->
<circle cx="356.25" cy="525.0" r="8" fill="purple"/>
<!-- Node 3 -->
<circle cx="393.75" cy="525.0" r="8" fill="purple"/>
<!-- Node 4 -->
<circle cx="431.25" cy="525.0" r="8" fill="purple"/>
<!-- Node 18 -->
<circle cx="525.0" cy="375.0" r="12" fill="blue"/>
</svg>
Create the tree programatically¶
from pytreesvg.node_svg import NodeSVG, NodeStyle
tree = NodeSVG('level_1', style='midnightblue@22')
# create new level
for i in range(4):
child = NodeSVG('level_2', style='darkslateblue@16')
tree.add_child(child)
# create new sub level
for j in range(4):
sub_child = NodeSVG('level_3', style='steelblue@12')
child.add_child(sub_child)
# create new sub sub level
for k in range(2):
sub_sub_child = NodeSVG('level_4', style='dodgerblue@8')
sub_child.add_child(sub_sub_child)
# create new sub sub sub level
for l in range(2):
sub_sub_child.add_child(NodeSVG('level_5', style='lightblue@4'))
tree.to_svg('source/_static/example_3.svg', width=800, height=600, gradient_color=True, image_border=False)
See example_3.svg
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<svg width="800" height="600" version="1.1" xmlns="http://www.w3.org/2000/svg">
<!-- image title -->
<title>Tree graphic created with pytreesvg</title>
<defs>
<!-- linear gradient definitions -->
<linearGradient id="grad_midnightblue_darkslateblue" x1="0%" x2="0%" y1="0%" y2="100%">
<stop offset="0%" stop-color="midnightblue"/>
<stop offset="100%" stop-color="darkslateblue"/>
</linearGradient>
<linearGradient id="grad_darkslateblue_steelblue" x1="0%" x2="0%" y1="0%" y2="100%">
<stop offset="0%" stop-color="darkslateblue"/>
<stop offset="100%" stop-color="steelblue"/>
</linearGradient>
<linearGradient id="grad_steelblue_dodgerblue" x1="0%" x2="0%" y1="0%" y2="100%">
<stop offset="0%" stop-color="steelblue"/>
<stop offset="100%" stop-color="dodgerblue"/>
</linearGradient>
<linearGradient id="grad_dodgerblue_lightblue" x1="0%" x2="0%" y1="0%" y2="100%">
<stop offset="0%" stop-color="dodgerblue"/>
<stop offset="100%" stop-color="lightblue"/>
</linearGradient>
</defs>
<!-- Node 'level_1' -->
<line x1="400.0" y1="60.0" x2="100.0" y2="180.0" stroke="url(#grad_midnightblue_darkslateblue)" stroke-width="2"/> <!-- edge to node 'level_2' -->
<line x1="400.0" y1="60.0" x2="300.0" y2="180.0" stroke="url(#grad_midnightblue_darkslateblue)" stroke-width="2"/> <!-- edge to node 'level_2' -->
<line x1="400.0" y1="60.0" x2="500.0" y2="180.0" stroke="url(#grad_midnightblue_darkslateblue)" stroke-width="2"/> <!-- edge to node 'level_2' -->
<line x1="400.0" y1="60.0" x2="700.0" y2="180.0" stroke="url(#grad_midnightblue_darkslateblue)" stroke-width="2"/> <!-- edge to node 'level_2' -->
<circle cx="400.0" cy="60.0" r="22" fill="midnightblue"/>
<!-- Node 'level_2' -->
<line x1="100.0" y1="180.0" x2="25.0" y2="300.0" stroke="url(#grad_darkslateblue_steelblue)" stroke-width="2"/> <!-- edge to node 'level_3' -->
<line x1="100.0" y1="180.0" x2="75.0" y2="300.0" stroke="url(#grad_darkslateblue_steelblue)" stroke-width="2"/> <!-- edge to node 'level_3' -->
<line x1="100.0" y1="180.0" x2="125.0" y2="300.0" stroke="url(#grad_darkslateblue_steelblue)" stroke-width="2"/> <!-- edge to node 'level_3' -->
<line x1="100.0" y1="180.0" x2="175.0" y2="300.0" stroke="url(#grad_darkslateblue_steelblue)" stroke-width="2"/> <!-- edge to node 'level_3' -->
<circle cx="100.0" cy="180.0" r="16" fill="darkslateblue"/>
<!-- Node 'level_3' -->
<line x1="25.0" y1="300.0" x2="12.5" y2="420.0" stroke="url(#grad_steelblue_dodgerblue)" stroke-width="2"/> <!-- edge to node 'level_4' -->
<line x1="25.0" y1="300.0" x2="37.5" y2="420.0" stroke="url(#grad_steelblue_dodgerblue)" stroke-width="2"/> <!-- edge to node 'level_4' -->
<circle cx="25.0" cy="300.0" r="12" fill="steelblue"/>
<!-- Node 'level_4' -->
<line x1="12.5" y1="420.0" x2="6.25" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<line x1="12.5" y1="420.0" x2="18.75" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<circle cx="12.5" cy="420.0" r="8" fill="dodgerblue"/>
<!-- Node 'level_5' -->
<circle cx="6.25" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_5' -->
<circle cx="18.75" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_4' -->
<line x1="37.5" y1="420.0" x2="31.25" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<line x1="37.5" y1="420.0" x2="43.75" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<circle cx="37.5" cy="420.0" r="8" fill="dodgerblue"/>
<!-- Node 'level_5' -->
<circle cx="31.25" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_5' -->
<circle cx="43.75" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_3' -->
<line x1="75.0" y1="300.0" x2="62.5" y2="420.0" stroke="url(#grad_steelblue_dodgerblue)" stroke-width="2"/> <!-- edge to node 'level_4' -->
<line x1="75.0" y1="300.0" x2="87.5" y2="420.0" stroke="url(#grad_steelblue_dodgerblue)" stroke-width="2"/> <!-- edge to node 'level_4' -->
<circle cx="75.0" cy="300.0" r="12" fill="steelblue"/>
<!-- Node 'level_4' -->
<line x1="62.5" y1="420.0" x2="56.25" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<line x1="62.5" y1="420.0" x2="68.75" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<circle cx="62.5" cy="420.0" r="8" fill="dodgerblue"/>
<!-- Node 'level_5' -->
<circle cx="56.25" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_5' -->
<circle cx="68.75" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_4' -->
<line x1="87.5" y1="420.0" x2="81.25" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<line x1="87.5" y1="420.0" x2="93.75" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<circle cx="87.5" cy="420.0" r="8" fill="dodgerblue"/>
<!-- Node 'level_5' -->
<circle cx="81.25" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_5' -->
<circle cx="93.75" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_3' -->
<line x1="125.0" y1="300.0" x2="112.5" y2="420.0" stroke="url(#grad_steelblue_dodgerblue)" stroke-width="2"/> <!-- edge to node 'level_4' -->
<line x1="125.0" y1="300.0" x2="137.5" y2="420.0" stroke="url(#grad_steelblue_dodgerblue)" stroke-width="2"/> <!-- edge to node 'level_4' -->
<circle cx="125.0" cy="300.0" r="12" fill="steelblue"/>
<!-- Node 'level_4' -->
<line x1="112.5" y1="420.0" x2="106.25" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<line x1="112.5" y1="420.0" x2="118.75" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<circle cx="112.5" cy="420.0" r="8" fill="dodgerblue"/>
<!-- Node 'level_5' -->
<circle cx="106.25" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_5' -->
<circle cx="118.75" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_4' -->
<line x1="137.5" y1="420.0" x2="131.25" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<line x1="137.5" y1="420.0" x2="143.75" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<circle cx="137.5" cy="420.0" r="8" fill="dodgerblue"/>
<!-- Node 'level_5' -->
<circle cx="131.25" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_5' -->
<circle cx="143.75" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_3' -->
<line x1="175.0" y1="300.0" x2="162.5" y2="420.0" stroke="url(#grad_steelblue_dodgerblue)" stroke-width="2"/> <!-- edge to node 'level_4' -->
<line x1="175.0" y1="300.0" x2="187.5" y2="420.0" stroke="url(#grad_steelblue_dodgerblue)" stroke-width="2"/> <!-- edge to node 'level_4' -->
<circle cx="175.0" cy="300.0" r="12" fill="steelblue"/>
<!-- Node 'level_4' -->
<line x1="162.5" y1="420.0" x2="156.25" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<line x1="162.5" y1="420.0" x2="168.75" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<circle cx="162.5" cy="420.0" r="8" fill="dodgerblue"/>
<!-- Node 'level_5' -->
<circle cx="156.25" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_5' -->
<circle cx="168.75" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_4' -->
<line x1="187.5" y1="420.0" x2="181.25" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<line x1="187.5" y1="420.0" x2="193.75" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<circle cx="187.5" cy="420.0" r="8" fill="dodgerblue"/>
<!-- Node 'level_5' -->
<circle cx="181.25" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_5' -->
<circle cx="193.75" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_2' -->
<line x1="300.0" y1="180.0" x2="225.0" y2="300.0" stroke="url(#grad_darkslateblue_steelblue)" stroke-width="2"/> <!-- edge to node 'level_3' -->
<line x1="300.0" y1="180.0" x2="275.0" y2="300.0" stroke="url(#grad_darkslateblue_steelblue)" stroke-width="2"/> <!-- edge to node 'level_3' -->
<line x1="300.0" y1="180.0" x2="325.0" y2="300.0" stroke="url(#grad_darkslateblue_steelblue)" stroke-width="2"/> <!-- edge to node 'level_3' -->
<line x1="300.0" y1="180.0" x2="375.0" y2="300.0" stroke="url(#grad_darkslateblue_steelblue)" stroke-width="2"/> <!-- edge to node 'level_3' -->
<circle cx="300.0" cy="180.0" r="16" fill="darkslateblue"/>
<!-- Node 'level_3' -->
<line x1="225.0" y1="300.0" x2="212.5" y2="420.0" stroke="url(#grad_steelblue_dodgerblue)" stroke-width="2"/> <!-- edge to node 'level_4' -->
<line x1="225.0" y1="300.0" x2="237.5" y2="420.0" stroke="url(#grad_steelblue_dodgerblue)" stroke-width="2"/> <!-- edge to node 'level_4' -->
<circle cx="225.0" cy="300.0" r="12" fill="steelblue"/>
<!-- Node 'level_4' -->
<line x1="212.5" y1="420.0" x2="206.25" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<line x1="212.5" y1="420.0" x2="218.75" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<circle cx="212.5" cy="420.0" r="8" fill="dodgerblue"/>
<!-- Node 'level_5' -->
<circle cx="206.25" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_5' -->
<circle cx="218.75" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_4' -->
<line x1="237.5" y1="420.0" x2="231.25" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<line x1="237.5" y1="420.0" x2="243.75" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<circle cx="237.5" cy="420.0" r="8" fill="dodgerblue"/>
<!-- Node 'level_5' -->
<circle cx="231.25" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_5' -->
<circle cx="243.75" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_3' -->
<line x1="275.0" y1="300.0" x2="262.5" y2="420.0" stroke="url(#grad_steelblue_dodgerblue)" stroke-width="2"/> <!-- edge to node 'level_4' -->
<line x1="275.0" y1="300.0" x2="287.5" y2="420.0" stroke="url(#grad_steelblue_dodgerblue)" stroke-width="2"/> <!-- edge to node 'level_4' -->
<circle cx="275.0" cy="300.0" r="12" fill="steelblue"/>
<!-- Node 'level_4' -->
<line x1="262.5" y1="420.0" x2="256.25" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<line x1="262.5" y1="420.0" x2="268.75" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<circle cx="262.5" cy="420.0" r="8" fill="dodgerblue"/>
<!-- Node 'level_5' -->
<circle cx="256.25" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_5' -->
<circle cx="268.75" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_4' -->
<line x1="287.5" y1="420.0" x2="281.25" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<line x1="287.5" y1="420.0" x2="293.75" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<circle cx="287.5" cy="420.0" r="8" fill="dodgerblue"/>
<!-- Node 'level_5' -->
<circle cx="281.25" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_5' -->
<circle cx="293.75" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_3' -->
<line x1="325.0" y1="300.0" x2="312.5" y2="420.0" stroke="url(#grad_steelblue_dodgerblue)" stroke-width="2"/> <!-- edge to node 'level_4' -->
<line x1="325.0" y1="300.0" x2="337.5" y2="420.0" stroke="url(#grad_steelblue_dodgerblue)" stroke-width="2"/> <!-- edge to node 'level_4' -->
<circle cx="325.0" cy="300.0" r="12" fill="steelblue"/>
<!-- Node 'level_4' -->
<line x1="312.5" y1="420.0" x2="306.25" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<line x1="312.5" y1="420.0" x2="318.75" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<circle cx="312.5" cy="420.0" r="8" fill="dodgerblue"/>
<!-- Node 'level_5' -->
<circle cx="306.25" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_5' -->
<circle cx="318.75" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_4' -->
<line x1="337.5" y1="420.0" x2="331.25" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<line x1="337.5" y1="420.0" x2="343.75" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<circle cx="337.5" cy="420.0" r="8" fill="dodgerblue"/>
<!-- Node 'level_5' -->
<circle cx="331.25" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_5' -->
<circle cx="343.75" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_3' -->
<line x1="375.0" y1="300.0" x2="362.5" y2="420.0" stroke="url(#grad_steelblue_dodgerblue)" stroke-width="2"/> <!-- edge to node 'level_4' -->
<line x1="375.0" y1="300.0" x2="387.5" y2="420.0" stroke="url(#grad_steelblue_dodgerblue)" stroke-width="2"/> <!-- edge to node 'level_4' -->
<circle cx="375.0" cy="300.0" r="12" fill="steelblue"/>
<!-- Node 'level_4' -->
<line x1="362.5" y1="420.0" x2="356.25" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<line x1="362.5" y1="420.0" x2="368.75" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<circle cx="362.5" cy="420.0" r="8" fill="dodgerblue"/>
<!-- Node 'level_5' -->
<circle cx="356.25" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_5' -->
<circle cx="368.75" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_4' -->
<line x1="387.5" y1="420.0" x2="381.25" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<line x1="387.5" y1="420.0" x2="393.75" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<circle cx="387.5" cy="420.0" r="8" fill="dodgerblue"/>
<!-- Node 'level_5' -->
<circle cx="381.25" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_5' -->
<circle cx="393.75" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_2' -->
<line x1="500.0" y1="180.0" x2="425.0" y2="300.0" stroke="url(#grad_darkslateblue_steelblue)" stroke-width="2"/> <!-- edge to node 'level_3' -->
<line x1="500.0" y1="180.0" x2="475.0" y2="300.0" stroke="url(#grad_darkslateblue_steelblue)" stroke-width="2"/> <!-- edge to node 'level_3' -->
<line x1="500.0" y1="180.0" x2="525.0" y2="300.0" stroke="url(#grad_darkslateblue_steelblue)" stroke-width="2"/> <!-- edge to node 'level_3' -->
<line x1="500.0" y1="180.0" x2="575.0" y2="300.0" stroke="url(#grad_darkslateblue_steelblue)" stroke-width="2"/> <!-- edge to node 'level_3' -->
<circle cx="500.0" cy="180.0" r="16" fill="darkslateblue"/>
<!-- Node 'level_3' -->
<line x1="425.0" y1="300.0" x2="412.5" y2="420.0" stroke="url(#grad_steelblue_dodgerblue)" stroke-width="2"/> <!-- edge to node 'level_4' -->
<line x1="425.0" y1="300.0" x2="437.5" y2="420.0" stroke="url(#grad_steelblue_dodgerblue)" stroke-width="2"/> <!-- edge to node 'level_4' -->
<circle cx="425.0" cy="300.0" r="12" fill="steelblue"/>
<!-- Node 'level_4' -->
<line x1="412.5" y1="420.0" x2="406.25" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<line x1="412.5" y1="420.0" x2="418.75" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<circle cx="412.5" cy="420.0" r="8" fill="dodgerblue"/>
<!-- Node 'level_5' -->
<circle cx="406.25" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_5' -->
<circle cx="418.75" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_4' -->
<line x1="437.5" y1="420.0" x2="431.25" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<line x1="437.5" y1="420.0" x2="443.75" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<circle cx="437.5" cy="420.0" r="8" fill="dodgerblue"/>
<!-- Node 'level_5' -->
<circle cx="431.25" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_5' -->
<circle cx="443.75" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_3' -->
<line x1="475.0" y1="300.0" x2="462.5" y2="420.0" stroke="url(#grad_steelblue_dodgerblue)" stroke-width="2"/> <!-- edge to node 'level_4' -->
<line x1="475.0" y1="300.0" x2="487.5" y2="420.0" stroke="url(#grad_steelblue_dodgerblue)" stroke-width="2"/> <!-- edge to node 'level_4' -->
<circle cx="475.0" cy="300.0" r="12" fill="steelblue"/>
<!-- Node 'level_4' -->
<line x1="462.5" y1="420.0" x2="456.25" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<line x1="462.5" y1="420.0" x2="468.75" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<circle cx="462.5" cy="420.0" r="8" fill="dodgerblue"/>
<!-- Node 'level_5' -->
<circle cx="456.25" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_5' -->
<circle cx="468.75" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_4' -->
<line x1="487.5" y1="420.0" x2="481.25" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<line x1="487.5" y1="420.0" x2="493.75" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<circle cx="487.5" cy="420.0" r="8" fill="dodgerblue"/>
<!-- Node 'level_5' -->
<circle cx="481.25" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_5' -->
<circle cx="493.75" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_3' -->
<line x1="525.0" y1="300.0" x2="512.5" y2="420.0" stroke="url(#grad_steelblue_dodgerblue)" stroke-width="2"/> <!-- edge to node 'level_4' -->
<line x1="525.0" y1="300.0" x2="537.5" y2="420.0" stroke="url(#grad_steelblue_dodgerblue)" stroke-width="2"/> <!-- edge to node 'level_4' -->
<circle cx="525.0" cy="300.0" r="12" fill="steelblue"/>
<!-- Node 'level_4' -->
<line x1="512.5" y1="420.0" x2="506.25" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<line x1="512.5" y1="420.0" x2="518.75" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<circle cx="512.5" cy="420.0" r="8" fill="dodgerblue"/>
<!-- Node 'level_5' -->
<circle cx="506.25" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_5' -->
<circle cx="518.75" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_4' -->
<line x1="537.5" y1="420.0" x2="531.25" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<line x1="537.5" y1="420.0" x2="543.75" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<circle cx="537.5" cy="420.0" r="8" fill="dodgerblue"/>
<!-- Node 'level_5' -->
<circle cx="531.25" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_5' -->
<circle cx="543.75" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_3' -->
<line x1="575.0" y1="300.0" x2="562.5" y2="420.0" stroke="url(#grad_steelblue_dodgerblue)" stroke-width="2"/> <!-- edge to node 'level_4' -->
<line x1="575.0" y1="300.0" x2="587.5" y2="420.0" stroke="url(#grad_steelblue_dodgerblue)" stroke-width="2"/> <!-- edge to node 'level_4' -->
<circle cx="575.0" cy="300.0" r="12" fill="steelblue"/>
<!-- Node 'level_4' -->
<line x1="562.5" y1="420.0" x2="556.25" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<line x1="562.5" y1="420.0" x2="568.75" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<circle cx="562.5" cy="420.0" r="8" fill="dodgerblue"/>
<!-- Node 'level_5' -->
<circle cx="556.25" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_5' -->
<circle cx="568.75" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_4' -->
<line x1="587.5" y1="420.0" x2="581.25" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<line x1="587.5" y1="420.0" x2="593.75" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<circle cx="587.5" cy="420.0" r="8" fill="dodgerblue"/>
<!-- Node 'level_5' -->
<circle cx="581.25" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_5' -->
<circle cx="593.75" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_2' -->
<line x1="700.0" y1="180.0" x2="625.0" y2="300.0" stroke="url(#grad_darkslateblue_steelblue)" stroke-width="2"/> <!-- edge to node 'level_3' -->
<line x1="700.0" y1="180.0" x2="675.0" y2="300.0" stroke="url(#grad_darkslateblue_steelblue)" stroke-width="2"/> <!-- edge to node 'level_3' -->
<line x1="700.0" y1="180.0" x2="725.0" y2="300.0" stroke="url(#grad_darkslateblue_steelblue)" stroke-width="2"/> <!-- edge to node 'level_3' -->
<line x1="700.0" y1="180.0" x2="775.0" y2="300.0" stroke="url(#grad_darkslateblue_steelblue)" stroke-width="2"/> <!-- edge to node 'level_3' -->
<circle cx="700.0" cy="180.0" r="16" fill="darkslateblue"/>
<!-- Node 'level_3' -->
<line x1="625.0" y1="300.0" x2="612.5" y2="420.0" stroke="url(#grad_steelblue_dodgerblue)" stroke-width="2"/> <!-- edge to node 'level_4' -->
<line x1="625.0" y1="300.0" x2="637.5" y2="420.0" stroke="url(#grad_steelblue_dodgerblue)" stroke-width="2"/> <!-- edge to node 'level_4' -->
<circle cx="625.0" cy="300.0" r="12" fill="steelblue"/>
<!-- Node 'level_4' -->
<line x1="612.5" y1="420.0" x2="606.25" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<line x1="612.5" y1="420.0" x2="618.75" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<circle cx="612.5" cy="420.0" r="8" fill="dodgerblue"/>
<!-- Node 'level_5' -->
<circle cx="606.25" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_5' -->
<circle cx="618.75" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_4' -->
<line x1="637.5" y1="420.0" x2="631.25" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<line x1="637.5" y1="420.0" x2="643.75" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<circle cx="637.5" cy="420.0" r="8" fill="dodgerblue"/>
<!-- Node 'level_5' -->
<circle cx="631.25" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_5' -->
<circle cx="643.75" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_3' -->
<line x1="675.0" y1="300.0" x2="662.5" y2="420.0" stroke="url(#grad_steelblue_dodgerblue)" stroke-width="2"/> <!-- edge to node 'level_4' -->
<line x1="675.0" y1="300.0" x2="687.5" y2="420.0" stroke="url(#grad_steelblue_dodgerblue)" stroke-width="2"/> <!-- edge to node 'level_4' -->
<circle cx="675.0" cy="300.0" r="12" fill="steelblue"/>
<!-- Node 'level_4' -->
<line x1="662.5" y1="420.0" x2="656.25" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<line x1="662.5" y1="420.0" x2="668.75" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<circle cx="662.5" cy="420.0" r="8" fill="dodgerblue"/>
<!-- Node 'level_5' -->
<circle cx="656.25" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_5' -->
<circle cx="668.75" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_4' -->
<line x1="687.5" y1="420.0" x2="681.25" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<line x1="687.5" y1="420.0" x2="693.75" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<circle cx="687.5" cy="420.0" r="8" fill="dodgerblue"/>
<!-- Node 'level_5' -->
<circle cx="681.25" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_5' -->
<circle cx="693.75" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_3' -->
<line x1="725.0" y1="300.0" x2="712.5" y2="420.0" stroke="url(#grad_steelblue_dodgerblue)" stroke-width="2"/> <!-- edge to node 'level_4' -->
<line x1="725.0" y1="300.0" x2="737.5" y2="420.0" stroke="url(#grad_steelblue_dodgerblue)" stroke-width="2"/> <!-- edge to node 'level_4' -->
<circle cx="725.0" cy="300.0" r="12" fill="steelblue"/>
<!-- Node 'level_4' -->
<line x1="712.5" y1="420.0" x2="706.25" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<line x1="712.5" y1="420.0" x2="718.75" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<circle cx="712.5" cy="420.0" r="8" fill="dodgerblue"/>
<!-- Node 'level_5' -->
<circle cx="706.25" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_5' -->
<circle cx="718.75" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_4' -->
<line x1="737.5" y1="420.0" x2="731.25" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<line x1="737.5" y1="420.0" x2="743.75" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<circle cx="737.5" cy="420.0" r="8" fill="dodgerblue"/>
<!-- Node 'level_5' -->
<circle cx="731.25" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_5' -->
<circle cx="743.75" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_3' -->
<line x1="775.0" y1="300.0" x2="762.5" y2="420.0" stroke="url(#grad_steelblue_dodgerblue)" stroke-width="2"/> <!-- edge to node 'level_4' -->
<line x1="775.0" y1="300.0" x2="787.5" y2="420.0" stroke="url(#grad_steelblue_dodgerblue)" stroke-width="2"/> <!-- edge to node 'level_4' -->
<circle cx="775.0" cy="300.0" r="12" fill="steelblue"/>
<!-- Node 'level_4' -->
<line x1="762.5" y1="420.0" x2="756.25" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<line x1="762.5" y1="420.0" x2="768.75" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<circle cx="762.5" cy="420.0" r="8" fill="dodgerblue"/>
<!-- Node 'level_5' -->
<circle cx="756.25" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_5' -->
<circle cx="768.75" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_4' -->
<line x1="787.5" y1="420.0" x2="781.25" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<line x1="787.5" y1="420.0" x2="793.75" y2="540.0" stroke="url(#grad_dodgerblue_lightblue)" stroke-width="2"/> <!-- edge to node 'level_5' -->
<circle cx="787.5" cy="420.0" r="8" fill="dodgerblue"/>
<!-- Node 'level_5' -->
<circle cx="781.25" cy="540.0" r="4" fill="lightblue"/>
<!-- Node 'level_5' -->
<circle cx="793.75" cy="540.0" r="4" fill="lightblue"/>
</svg>
You may notice in this example that the pytreesvg.node_svg.NodeSVG.add_child()
method is not doing a deep copy of
the given NodeSVG
object, any subsequent modification of the given node will modify the tree containing this node (
see pytreesvg.node_svg.NodeSVG.add_child()
Warnings to have an example).
Create some random tree¶
Let’s create a random tree with the default creation parameters:
from pytreesvg.node_svg import NodeSVG
import random
random.seed(11) # set random number generator seed for reproducible results
# create random tree
tree = NodeSVG.get_random_tree()
tree.to_svg(path='source/_static/example_4.1.svg', width=600, height=600, gradient_color=True)
See example_4.1.svg
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<svg width="600" height="600" version="1.1" xmlns="http://www.w3.org/2000/svg">
<!-- image title -->
<title>Tree graphic created with pytreesvg</title>
<defs>
<!-- linear gradient definitions -->
<linearGradient id="grad_rgb.231.238.231_rgb.243.95.48" x1="0%" x2="0%" y1="0%" y2="100%">
<stop offset="0%" stop-color="rgb(231,238,231)"/>
<stop offset="100%" stop-color="rgb(243,95,48)"/>
</linearGradient>
<linearGradient id="grad_rgb.243.95.48_rgb.46.21.202" x1="0%" x2="0%" y1="0%" y2="100%">
<stop offset="0%" stop-color="rgb(243,95,48)"/>
<stop offset="100%" stop-color="rgb(46,21,202)"/>
</linearGradient>
<linearGradient id="grad_rgb.46.21.202_rgb.7.32.30" x1="0%" x2="0%" y1="0%" y2="100%">
<stop offset="0%" stop-color="rgb(46,21,202)"/>
<stop offset="100%" stop-color="rgb(7,32,30)"/>
</linearGradient>
<linearGradient id="grad_rgb.7.32.30_rgb.15.237.167" x1="0%" x2="0%" y1="0%" y2="100%">
<stop offset="0%" stop-color="rgb(7,32,30)"/>
<stop offset="100%" stop-color="rgb(15,237,167)"/>
</linearGradient>
<linearGradient id="grad_rgb.15.237.167_rgb.119.150.255" x1="0%" x2="0%" y1="0%" y2="100%">
<stop offset="0%" stop-color="rgb(15,237,167)"/>
<stop offset="100%" stop-color="rgb(119,150,255)"/>
</linearGradient>
<linearGradient id="grad_rgb.15.237.167_rgb.142.208.42" x1="0%" x2="0%" y1="0%" y2="100%">
<stop offset="0%" stop-color="rgb(15,237,167)"/>
<stop offset="100%" stop-color="rgb(142,208,42)"/>
</linearGradient>
<linearGradient id="grad_rgb.15.237.167_rgb.147.15.35" x1="0%" x2="0%" y1="0%" y2="100%">
<stop offset="0%" stop-color="rgb(15,237,167)"/>
<stop offset="100%" stop-color="rgb(147,15,35)"/>
</linearGradient>
<linearGradient id="grad_rgb.15.237.167_rgb.55.148.197" x1="0%" x2="0%" y1="0%" y2="100%">
<stop offset="0%" stop-color="rgb(15,237,167)"/>
<stop offset="100%" stop-color="rgb(55,148,197)"/>
</linearGradient>
<linearGradient id="grad_rgb.46.21.202_rgb.109.107.26" x1="0%" x2="0%" y1="0%" y2="100%">
<stop offset="0%" stop-color="rgb(46,21,202)"/>
<stop offset="100%" stop-color="rgb(109,107,26)"/>
</linearGradient>
<linearGradient id="grad_rgb.109.107.26_rgb.214.37.101" x1="0%" x2="0%" y1="0%" y2="100%">
<stop offset="0%" stop-color="rgb(109,107,26)"/>
<stop offset="100%" stop-color="rgb(214,37,101)"/>
</linearGradient>
<linearGradient id="grad_rgb.109.107.26_rgb.159.170.7" x1="0%" x2="0%" y1="0%" y2="100%">
<stop offset="0%" stop-color="rgb(109,107,26)"/>
<stop offset="100%" stop-color="rgb(159,170,7)"/>
</linearGradient>
<linearGradient id="grad_rgb.159.170.7_rgb.126.51.5" x1="0%" x2="0%" y1="0%" y2="100%">
<stop offset="0%" stop-color="rgb(159,170,7)"/>
<stop offset="100%" stop-color="rgb(126,51,5)"/>
</linearGradient>
<linearGradient id="grad_rgb.109.107.26_rgb.90.96.229" x1="0%" x2="0%" y1="0%" y2="100%">
<stop offset="0%" stop-color="rgb(109,107,26)"/>
<stop offset="100%" stop-color="rgb(90,96,229)"/>
</linearGradient>
<linearGradient id="grad_rgb.90.96.229_rgb.214.196.59" x1="0%" x2="0%" y1="0%" y2="100%">
<stop offset="0%" stop-color="rgb(90,96,229)"/>
<stop offset="100%" stop-color="rgb(214,196,59)"/>
</linearGradient>
<linearGradient id="grad_rgb.46.21.202_rgb.0.138.155" x1="0%" x2="0%" y1="0%" y2="100%">
<stop offset="0%" stop-color="rgb(46,21,202)"/>
<stop offset="100%" stop-color="rgb(0,138,155)"/>
</linearGradient>
<linearGradient id="grad_rgb.0.138.155_rgb.201.51.21" x1="0%" x2="0%" y1="0%" y2="100%">
<stop offset="0%" stop-color="rgb(0,138,155)"/>
<stop offset="100%" stop-color="rgb(201,51,21)"/>
</linearGradient>
<linearGradient id="grad_rgb.201.51.21_rgb.132.4.168" x1="0%" x2="0%" y1="0%" y2="100%">
<stop offset="0%" stop-color="rgb(201,51,21)"/>
<stop offset="100%" stop-color="rgb(132,4,168)"/>
</linearGradient>
<linearGradient id="grad_rgb.201.51.21_rgb.38.46.106" x1="0%" x2="0%" y1="0%" y2="100%">
<stop offset="0%" stop-color="rgb(201,51,21)"/>
<stop offset="100%" stop-color="rgb(38,46,106)"/>
</linearGradient>
<linearGradient id="grad_rgb.201.51.21_rgb.188.190.232" x1="0%" x2="0%" y1="0%" y2="100%">
<stop offset="0%" stop-color="rgb(201,51,21)"/>
<stop offset="100%" stop-color="rgb(188,190,232)"/>
</linearGradient>
<linearGradient id="grad_rgb.46.21.202_rgb.69.197.93" x1="0%" x2="0%" y1="0%" y2="100%">
<stop offset="0%" stop-color="rgb(46,21,202)"/>
<stop offset="100%" stop-color="rgb(69,197,93)"/>
</linearGradient>
<linearGradient id="grad_rgb.69.197.93_rgb.127.97.81" x1="0%" x2="0%" y1="0%" y2="100%">
<stop offset="0%" stop-color="rgb(69,197,93)"/>
<stop offset="100%" stop-color="rgb(127,97,81)"/>
</linearGradient>
<linearGradient id="grad_rgb.127.97.81_rgb.247.40.215" x1="0%" x2="0%" y1="0%" y2="100%">
<stop offset="0%" stop-color="rgb(127,97,81)"/>
<stop offset="100%" stop-color="rgb(247,40,215)"/>
</linearGradient>
<linearGradient id="grad_rgb.127.97.81_rgb.19.130.122" x1="0%" x2="0%" y1="0%" y2="100%">
<stop offset="0%" stop-color="rgb(127,97,81)"/>
<stop offset="100%" stop-color="rgb(19,130,122)"/>
</linearGradient>
<linearGradient id="grad_rgb.127.97.81_rgb.251.150.89" x1="0%" x2="0%" y1="0%" y2="100%">
<stop offset="0%" stop-color="rgb(127,97,81)"/>
<stop offset="100%" stop-color="rgb(251,150,89)"/>
</linearGradient>
</defs>
<!-- image border -->
<rect x="0" y="0" width="600" height="600" style="stroke: #000000; fill: none;"/>
<!-- Node 8 -->
<line x1="300.0" y1="50.0" x2="300.0" y2="150.0" stroke="url(#grad_rgb.231.238.231_rgb.243.95.48)" stroke-width="2"/> <!-- edge to node 7 -->
<circle cx="300.0" cy="50.0" r="11" fill="rgb(231,238,231)"/>
<!-- Node 7 -->
<line x1="300.0" y1="150.0" x2="300.0" y2="250.0" stroke="url(#grad_rgb.243.95.48_rgb.46.21.202)" stroke-width="2"/> <!-- edge to node 7 -->
<circle cx="300.0" cy="150.0" r="14" fill="rgb(243,95,48)"/>
<!-- Node 7 -->
<line x1="300.0" y1="250.0" x2="75.0" y2="350.0" stroke="url(#grad_rgb.46.21.202_rgb.7.32.30)" stroke-width="2"/> <!-- edge to node 0 -->
<line x1="300.0" y1="250.0" x2="225.0" y2="350.0" stroke="url(#grad_rgb.46.21.202_rgb.109.107.26)" stroke-width="2"/> <!-- edge to node 7 -->
<line x1="300.0" y1="250.0" x2="375.0" y2="350.0" stroke="url(#grad_rgb.46.21.202_rgb.0.138.155)" stroke-width="2"/> <!-- edge to node 0 -->
<line x1="300.0" y1="250.0" x2="525.0" y2="350.0" stroke="url(#grad_rgb.46.21.202_rgb.69.197.93)" stroke-width="2"/> <!-- edge to node 2 -->
<circle cx="300.0" cy="250.0" r="10" fill="rgb(46,21,202)"/>
<!-- Node 0 -->
<line x1="75.0" y1="350.0" x2="75.0" y2="450.0" stroke="url(#grad_rgb.7.32.30_rgb.15.237.167)" stroke-width="2"/> <!-- edge to node 7 -->
<circle cx="75.0" cy="350.0" r="11" fill="rgb(7,32,30)"/>
<!-- Node 7 -->
<line x1="75.0" y1="450.0" x2="18.75" y2="550.0" stroke="url(#grad_rgb.15.237.167_rgb.119.150.255)" stroke-width="2"/> <!-- edge to node 0 -->
<line x1="75.0" y1="450.0" x2="56.25" y2="550.0" stroke="url(#grad_rgb.15.237.167_rgb.142.208.42)" stroke-width="2"/> <!-- edge to node 4 -->
<line x1="75.0" y1="450.0" x2="93.75" y2="550.0" stroke="url(#grad_rgb.15.237.167_rgb.147.15.35)" stroke-width="2"/> <!-- edge to node 9 -->
<line x1="75.0" y1="450.0" x2="131.25" y2="550.0" stroke="url(#grad_rgb.15.237.167_rgb.55.148.197)" stroke-width="2"/> <!-- edge to node 1 -->
<circle cx="75.0" cy="450.0" r="11" fill="rgb(15,237,167)"/>
<!-- Node 0 -->
<circle cx="18.75" cy="550.0" r="7" fill="rgb(119,150,255)"/>
<!-- Node 4 -->
<circle cx="56.25" cy="550.0" r="15" fill="rgb(142,208,42)"/>
<!-- Node 9 -->
<circle cx="93.75" cy="550.0" r="8" fill="rgb(147,15,35)"/>
<!-- Node 1 -->
<circle cx="131.25" cy="550.0" r="5" fill="rgb(55,148,197)"/>
<!-- Node 7 -->
<line x1="225.0" y1="350.0" x2="175.0" y2="450.0" stroke="url(#grad_rgb.109.107.26_rgb.214.37.101)" stroke-width="2"/> <!-- edge to node 4 -->
<line x1="225.0" y1="350.0" x2="225.0" y2="450.0" stroke="url(#grad_rgb.109.107.26_rgb.159.170.7)" stroke-width="2"/> <!-- edge to node 6 -->
<line x1="225.0" y1="350.0" x2="275.0" y2="450.0" stroke="url(#grad_rgb.109.107.26_rgb.90.96.229)" stroke-width="2"/> <!-- edge to node 8 -->
<circle cx="225.0" cy="350.0" r="17" fill="rgb(109,107,26)"/>
<!-- Node 4 -->
<circle cx="175.0" cy="450.0" r="15" fill="rgb(214,37,101)"/>
<!-- Node 6 -->
<line x1="225.0" y1="450.0" x2="225.0" y2="550.0" stroke="url(#grad_rgb.159.170.7_rgb.126.51.5)" stroke-width="2"/> <!-- edge to node 0 -->
<circle cx="225.0" cy="450.0" r="8" fill="rgb(159,170,7)"/>
<!-- Node 0 -->
<circle cx="225.0" cy="550.0" r="19" fill="rgb(126,51,5)"/>
<!-- Node 8 -->
<line x1="275.0" y1="450.0" x2="275.0" y2="550.0" stroke="url(#grad_rgb.90.96.229_rgb.214.196.59)" stroke-width="2"/> <!-- edge to node 6 -->
<circle cx="275.0" cy="450.0" r="11" fill="rgb(90,96,229)"/>
<!-- Node 6 -->
<circle cx="275.0" cy="550.0" r="18" fill="rgb(214,196,59)"/>
<!-- Node 0 -->
<line x1="375.0" y1="350.0" x2="375.0" y2="450.0" stroke="url(#grad_rgb.0.138.155_rgb.201.51.21)" stroke-width="2"/> <!-- edge to node 2 -->
<circle cx="375.0" cy="350.0" r="11" fill="rgb(0,138,155)"/>
<!-- Node 2 -->
<line x1="375.0" y1="450.0" x2="325.0" y2="550.0" stroke="url(#grad_rgb.201.51.21_rgb.132.4.168)" stroke-width="2"/> <!-- edge to node 4 -->
<line x1="375.0" y1="450.0" x2="375.0" y2="550.0" stroke="url(#grad_rgb.201.51.21_rgb.38.46.106)" stroke-width="2"/> <!-- edge to node 9 -->
<line x1="375.0" y1="450.0" x2="425.0" y2="550.0" stroke="url(#grad_rgb.201.51.21_rgb.188.190.232)" stroke-width="2"/> <!-- edge to node 2 -->
<circle cx="375.0" cy="450.0" r="11" fill="rgb(201,51,21)"/>
<!-- Node 4 -->
<circle cx="325.0" cy="550.0" r="17" fill="rgb(132,4,168)"/>
<!-- Node 9 -->
<circle cx="375.0" cy="550.0" r="12" fill="rgb(38,46,106)"/>
<!-- Node 2 -->
<circle cx="425.0" cy="550.0" r="20" fill="rgb(188,190,232)"/>
<!-- Node 2 -->
<line x1="525.0" y1="350.0" x2="525.0" y2="450.0" stroke="url(#grad_rgb.69.197.93_rgb.127.97.81)" stroke-width="2"/> <!-- edge to node 8 -->
<circle cx="525.0" cy="350.0" r="14" fill="rgb(69,197,93)"/>
<!-- Node 8 -->
<line x1="525.0" y1="450.0" x2="475.0" y2="550.0" stroke="url(#grad_rgb.127.97.81_rgb.247.40.215)" stroke-width="2"/> <!-- edge to node 0 -->
<line x1="525.0" y1="450.0" x2="525.0" y2="550.0" stroke="url(#grad_rgb.127.97.81_rgb.19.130.122)" stroke-width="2"/> <!-- edge to node 6 -->
<line x1="525.0" y1="450.0" x2="575.0" y2="550.0" stroke="url(#grad_rgb.127.97.81_rgb.251.150.89)" stroke-width="2"/> <!-- edge to node 1 -->
<circle cx="525.0" cy="450.0" r="11" fill="rgb(127,97,81)"/>
<!-- Node 0 -->
<circle cx="475.0" cy="550.0" r="8" fill="rgb(247,40,215)"/>
<!-- Node 6 -->
<circle cx="525.0" cy="550.0" r="13" fill="rgb(19,130,122)"/>
<!-- Node 1 -->
<circle cx="575.0" cy="550.0" r="9" fill="rgb(251,150,89)"/>
</svg>
Now let’s customize a little the random tree creation parameters:
from pytreesvg.node_svg import NodeSVG
import random
random.seed(30) # set random number generator seed for reproducible results
# create random tree with custom creation parameters
tree = NodeSVG.get_random_tree(max_depth=3,
n_children=[0, 1, 2, 3, 4],
values=['Michel', 'Julia', 'Robert'],
sizes=[7, 10, 13],
colors=['crimson', 'salmon', '#ffcc5c', 'rgb(58%, 10%, 10%)'])
tree.to_svg(path='source/_static/example_4.2.svg', width=800, height=600, gradient_color=True)
See example_4.2.svg
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<svg width="800" height="600" version="1.1" xmlns="http://www.w3.org/2000/svg">
<!-- image title -->
<title>Tree graphic created with pytreesvg</title>
<defs>
<!-- linear gradient definitions -->
<linearGradient id="grad_ffcc5c_salmon" x1="0%" x2="0%" y1="0%" y2="100%">
<stop offset="0%" stop-color="#ffcc5c"/>
<stop offset="100%" stop-color="salmon"/>
</linearGradient>
<linearGradient id="grad_salmon_rgb.58p.10p.10p" x1="0%" x2="0%" y1="0%" y2="100%">
<stop offset="0%" stop-color="salmon"/>
<stop offset="100%" stop-color="rgb(58%, 10%, 10%)"/>
</linearGradient>
<linearGradient id="grad_ffcc5c_rgb.58p.10p.10p" x1="0%" x2="0%" y1="0%" y2="100%">
<stop offset="0%" stop-color="#ffcc5c"/>
<stop offset="100%" stop-color="rgb(58%, 10%, 10%)"/>
</linearGradient>
<linearGradient id="grad_rgb.58p.10p.10p_ffcc5c" x1="0%" x2="0%" y1="0%" y2="100%">
<stop offset="0%" stop-color="rgb(58%, 10%, 10%)"/>
<stop offset="100%" stop-color="#ffcc5c"/>
</linearGradient>
<linearGradient id="grad_rgb.58p.10p.10p_crimson" x1="0%" x2="0%" y1="0%" y2="100%">
<stop offset="0%" stop-color="rgb(58%, 10%, 10%)"/>
<stop offset="100%" stop-color="crimson"/>
</linearGradient>
<linearGradient id="grad_rgb.58p.10p.10p_salmon" x1="0%" x2="0%" y1="0%" y2="100%">
<stop offset="0%" stop-color="rgb(58%, 10%, 10%)"/>
<stop offset="100%" stop-color="salmon"/>
</linearGradient>
<linearGradient id="grad_salmon_crimson" x1="0%" x2="0%" y1="0%" y2="100%">
<stop offset="0%" stop-color="salmon"/>
<stop offset="100%" stop-color="crimson"/>
</linearGradient>
</defs>
<!-- image border -->
<rect x="0" y="0" width="800" height="600" style="stroke: #000000; fill: none;"/>
<!-- Node 'Robert' -->
<line x1="400.0" y1="75.0" x2="100.0" y2="225.0" stroke="url(#grad_ffcc5c_salmon)" stroke-width="2"/> <!-- edge to node 'Julia' -->
<line x1="400.0" y1="75.0" x2="300.0" y2="225.0" stroke="#ffcc5c" stroke-width="2"/> <!-- edge to node 'Julia' -->
<line x1="400.0" y1="75.0" x2="500.0" y2="225.0" stroke="url(#grad_ffcc5c_salmon)" stroke-width="2"/> <!-- edge to node 'Michel' -->
<line x1="400.0" y1="75.0" x2="700.0" y2="225.0" stroke="url(#grad_ffcc5c_rgb.58p.10p.10p)" stroke-width="2"/> <!-- edge to node 'Julia' -->
<circle cx="400.0" cy="75.0" r="7" fill="#ffcc5c"/>
<!-- Node 'Julia' -->
<line x1="100.0" y1="225.0" x2="33.33333333333333" y2="375.0" stroke="url(#grad_salmon_rgb.58p.10p.10p)" stroke-width="2"/> <!-- edge to node 'Robert' -->
<line x1="100.0" y1="225.0" x2="100.0" y2="375.0" stroke="url(#grad_salmon_rgb.58p.10p.10p)" stroke-width="2"/> <!-- edge to node 'Michel' -->
<line x1="100.0" y1="225.0" x2="166.66666666666669" y2="375.0" stroke="url(#grad_salmon_rgb.58p.10p.10p)" stroke-width="2"/> <!-- edge to node 'Robert' -->
<circle cx="100.0" cy="225.0" r="7" fill="salmon"/>
<!-- Node 'Robert' -->
<circle cx="33.33333333333333" cy="375.0" r="7" fill="rgb(58%, 10%, 10%)"/>
<!-- Node 'Michel' -->
<line x1="100.0" y1="375.0" x2="100.0" y2="525.0" stroke="url(#grad_rgb.58p.10p.10p_crimson)" stroke-width="2"/> <!-- edge to node 'Michel' -->
<circle cx="100.0" cy="375.0" r="13" fill="rgb(58%, 10%, 10%)"/>
<!-- Node 'Michel' -->
<circle cx="100.0" cy="525.0" r="7" fill="crimson"/>
<!-- Node 'Robert' -->
<line x1="166.66666666666669" y1="375.0" x2="141.66666666666666" y2="525.0" stroke="url(#grad_rgb.58p.10p.10p_crimson)" stroke-width="2"/> <!-- edge to node 'Julia' -->
<line x1="166.66666666666669" y1="375.0" x2="158.33333333333331" y2="525.0" stroke="url(#grad_rgb.58p.10p.10p_ffcc5c)" stroke-width="2"/> <!-- edge to node 'Julia' -->
<line x1="166.66666666666669" y1="375.0" x2="175.0" y2="525.0" stroke="url(#grad_rgb.58p.10p.10p_ffcc5c)" stroke-width="2"/> <!-- edge to node 'Robert' -->
<line x1="166.66666666666669" y1="375.0" x2="191.66666666666666" y2="525.0" stroke="rgb(58%, 10%, 10%)" stroke-width="2"/> <!-- edge to node 'Julia' -->
<circle cx="166.66666666666669" cy="375.0" r="10" fill="rgb(58%, 10%, 10%)"/>
<!-- Node 'Julia' -->
<circle cx="141.66666666666666" cy="525.0" r="7" fill="crimson"/>
<!-- Node 'Julia' -->
<circle cx="158.33333333333331" cy="525.0" r="13" fill="#ffcc5c"/>
<!-- Node 'Robert' -->
<circle cx="175.0" cy="525.0" r="13" fill="#ffcc5c"/>
<!-- Node 'Julia' -->
<circle cx="191.66666666666666" cy="525.0" r="7" fill="rgb(58%, 10%, 10%)"/>
<!-- Node 'Julia' -->
<circle cx="300.0" cy="225.0" r="13" fill="#ffcc5c"/>
<!-- Node 'Michel' -->
<line x1="500.0" y1="225.0" x2="450.0" y2="375.0" stroke="url(#grad_salmon_crimson)" stroke-width="2"/> <!-- edge to node 'Michel' -->
<line x1="500.0" y1="225.0" x2="550.0" y2="375.0" stroke="url(#grad_salmon_rgb.58p.10p.10p)" stroke-width="2"/> <!-- edge to node 'Julia' -->
<circle cx="500.0" cy="225.0" r="13" fill="salmon"/>
<!-- Node 'Michel' -->
<line x1="450.0" y1="375.0" x2="412.5" y2="525.0" stroke="url(#grad_crimson_ffcc5c)" stroke-width="2"/> <!-- edge to node 'Michel' -->
<line x1="450.0" y1="375.0" x2="437.5" y2="525.0" stroke="url(#grad_crimson_rgb.58p.10p.10p)" stroke-width="2"/> <!-- edge to node 'Robert' -->
<line x1="450.0" y1="375.0" x2="462.5" y2="525.0" stroke="url(#grad_crimson_rgb.58p.10p.10p)" stroke-width="2"/> <!-- edge to node 'Robert' -->
<line x1="450.0" y1="375.0" x2="487.5" y2="525.0" stroke="url(#grad_crimson_ffcc5c)" stroke-width="2"/> <!-- edge to node 'Michel' -->
<circle cx="450.0" cy="375.0" r="10" fill="crimson"/>
<!-- Node 'Michel' -->
<circle cx="412.5" cy="525.0" r="13" fill="#ffcc5c"/>
<!-- Node 'Robert' -->
<circle cx="437.5" cy="525.0" r="10" fill="rgb(58%, 10%, 10%)"/>
<!-- Node 'Robert' -->
<circle cx="462.5" cy="525.0" r="10" fill="rgb(58%, 10%, 10%)"/>
<!-- Node 'Michel' -->
<circle cx="487.5" cy="525.0" r="7" fill="#ffcc5c"/>
<!-- Node 'Julia' -->
<line x1="550.0" y1="375.0" x2="516.6666666666666" y2="525.0" stroke="url(#grad_rgb.58p.10p.10p_ffcc5c)" stroke-width="2"/> <!-- edge to node 'Robert' -->
<line x1="550.0" y1="375.0" x2="550.0" y2="525.0" stroke="url(#grad_rgb.58p.10p.10p_salmon)" stroke-width="2"/> <!-- edge to node 'Michel' -->
<line x1="550.0" y1="375.0" x2="583.3333333333334" y2="525.0" stroke="rgb(58%, 10%, 10%)" stroke-width="2"/> <!-- edge to node 'Robert' -->
<circle cx="550.0" cy="375.0" r="10" fill="rgb(58%, 10%, 10%)"/>
<!-- Node 'Robert' -->
<circle cx="516.6666666666666" cy="525.0" r="10" fill="#ffcc5c"/>
<!-- Node 'Michel' -->
<circle cx="550.0" cy="525.0" r="13" fill="salmon"/>
<!-- Node 'Robert' -->
<circle cx="583.3333333333334" cy="525.0" r="7" fill="rgb(58%, 10%, 10%)"/>
<!-- Node 'Julia' -->
<line x1="700.0" y1="225.0" x2="625.0" y2="375.0" stroke="url(#grad_rgb.58p.10p.10p_ffcc5c)" stroke-width="2"/> <!-- edge to node 'Robert' -->
<line x1="700.0" y1="225.0" x2="675.0" y2="375.0" stroke="url(#grad_rgb.58p.10p.10p_crimson)" stroke-width="2"/> <!-- edge to node 'Robert' -->
<line x1="700.0" y1="225.0" x2="725.0" y2="375.0" stroke="url(#grad_rgb.58p.10p.10p_ffcc5c)" stroke-width="2"/> <!-- edge to node 'Robert' -->
<line x1="700.0" y1="225.0" x2="775.0" y2="375.0" stroke="url(#grad_rgb.58p.10p.10p_salmon)" stroke-width="2"/> <!-- edge to node 'Michel' -->
<circle cx="700.0" cy="225.0" r="10" fill="rgb(58%, 10%, 10%)"/>
<!-- Node 'Robert' -->
<line x1="625.0" y1="375.0" x2="608.3333333333334" y2="525.0" stroke="#ffcc5c" stroke-width="2"/> <!-- edge to node 'Robert' -->
<line x1="625.0" y1="375.0" x2="625.0" y2="525.0" stroke="#ffcc5c" stroke-width="2"/> <!-- edge to node 'Julia' -->
<line x1="625.0" y1="375.0" x2="641.6666666666666" y2="525.0" stroke="url(#grad_ffcc5c_salmon)" stroke-width="2"/> <!-- edge to node 'Julia' -->
<circle cx="625.0" cy="375.0" r="10" fill="#ffcc5c"/>
<!-- Node 'Robert' -->
<circle cx="608.3333333333334" cy="525.0" r="13" fill="#ffcc5c"/>
<!-- Node 'Julia' -->
<circle cx="625.0" cy="525.0" r="13" fill="#ffcc5c"/>
<!-- Node 'Julia' -->
<circle cx="641.6666666666666" cy="525.0" r="13" fill="salmon"/>
<!-- Node 'Robert' -->
<circle cx="675.0" cy="375.0" r="7" fill="crimson"/>
<!-- Node 'Robert' -->
<line x1="725.0" y1="375.0" x2="706.25" y2="525.0" stroke="#ffcc5c" stroke-width="2"/> <!-- edge to node 'Julia' -->
<line x1="725.0" y1="375.0" x2="718.75" y2="525.0" stroke="url(#grad_ffcc5c_crimson)" stroke-width="2"/> <!-- edge to node 'Robert' -->
<line x1="725.0" y1="375.0" x2="731.25" y2="525.0" stroke="url(#grad_ffcc5c_salmon)" stroke-width="2"/> <!-- edge to node 'Robert' -->
<line x1="725.0" y1="375.0" x2="743.75" y2="525.0" stroke="#ffcc5c" stroke-width="2"/> <!-- edge to node 'Julia' -->
<circle cx="725.0" cy="375.0" r="7" fill="#ffcc5c"/>
<!-- Node 'Julia' -->
<circle cx="706.25" cy="525.0" r="13" fill="#ffcc5c"/>
<!-- Node 'Robert' -->
<circle cx="718.75" cy="525.0" r="10" fill="crimson"/>
<!-- Node 'Robert' -->
<circle cx="731.25" cy="525.0" r="10" fill="salmon"/>
<!-- Node 'Julia' -->
<circle cx="743.75" cy="525.0" r="10" fill="#ffcc5c"/>
<!-- Node 'Michel' -->
<line x1="775.0" y1="375.0" x2="756.25" y2="525.0" stroke="url(#grad_salmon_crimson)" stroke-width="2"/> <!-- edge to node 'Robert' -->
<line x1="775.0" y1="375.0" x2="768.75" y2="525.0" stroke="salmon" stroke-width="2"/> <!-- edge to node 'Julia' -->
<line x1="775.0" y1="375.0" x2="781.25" y2="525.0" stroke="url(#grad_salmon_crimson)" stroke-width="2"/> <!-- edge to node 'Michel' -->
<line x1="775.0" y1="375.0" x2="793.75" y2="525.0" stroke="url(#grad_salmon_rgb.58p.10p.10p)" stroke-width="2"/> <!-- edge to node 'Michel' -->
<circle cx="775.0" cy="375.0" r="10" fill="salmon"/>
<!-- Node 'Robert' -->
<circle cx="756.25" cy="525.0" r="10" fill="crimson"/>
<!-- Node 'Julia' -->
<circle cx="768.75" cy="525.0" r="13" fill="salmon"/>
<!-- Node 'Michel' -->
<circle cx="781.25" cy="525.0" r="10" fill="crimson"/>
<!-- Node 'Michel' -->
<circle cx="793.75" cy="525.0" r="10" fill="rgb(58%, 10%, 10%)"/>
</svg>