Last active
February 27, 2020 11:11
-
-
Save mixstef/cb35b1f7cb5490f1b856 to your computer and use it in GitHub Desktop.
Παράδειγμα χρήσης του module pydot
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 pydot | |
# create the pydot directed graph | |
g = pydot.Dot(graph_type='digraph',splines='true',overlap='false',size='80.0,80.0') | |
# add a graph node | |
node = pydot.Node("n1",shape='circle',style='filled',fillcolor='#FFFFFF',fontsize='8',margin='0') | |
node.set_label('"α"') | |
g.add_node(node) | |
# add a second node | |
node = pydot.Node("n2",shape='circle',style='filled',fillcolor='#FFFFFF',fontsize='8',margin='0') | |
node.set_label('"β"') | |
g.add_node(node) | |
# add an edge to graph | |
e = pydot.Edge("n1","n2",color="#f89f12",fontsize='7') | |
e.set_label('"α to β"') | |
g.add_edge(e) | |
# output graph (svg format) | |
g.write('test.svg',prog='neato',format='svg') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment