Changed the font and node colors.
authorFrancois Fleuret <francois@fleuret.org>
Mon, 21 Aug 2017 11:59:35 +0000 (13:59 +0200)
committerFrancois Fleuret <francois@fleuret.org>
Mon, 21 Aug 2017 11:59:35 +0000 (13:59 +0200)
agtree2dot.py
mlp.pdf
mlp.py

index 8cc9e8c..0f787ac 100755 (executable)
@@ -103,20 +103,24 @@ def fill_graph_lists(u, node_labels, node_list, link_list):
 def print_dot(node_list, link_list, out):
     out.write('digraph{\n')
 
+    out.write('  graph [fontname = "helvetica"];\n')
+    out.write('  node [fontname = "helvetica"];\n')
+    out.write('  edge [fontname = "helvetica"];\n')
+
     for n in node_list:
         node = node_list[n]
 
         if isinstance(n, torch.autograd.Variable):
             out.write(
                 '  ' + \
-                str(node.id) + ' [shape=note,label="' + \
+                str(node.id) + ' [shape=note,style=filled, fillcolor="#e0e0ff",label="' + \
                 node.label + ' ' + re.search('torch\.Size\((.*)\)', str(n.data.size())).group(1) + \
                 '"]\n'
             )
         else:
             out.write(
                 '  ' + \
-                str(node.id) + ' [shape=record,label="{ ' + \
+                str(node.id) + ' [shape=record,style=filled, fillcolor="#f0f0f0",label="{ ' + \
                 slot_string(node.max_out, for_input = True) + \
                 node.label + \
                 slot_string(node.max_in, for_input = False) + \
diff --git a/mlp.pdf b/mlp.pdf
index 52dea89..a950b22 100644 (file)
Binary files a/mlp.pdf and b/mlp.pdf differ
diff --git a/mlp.py b/mlp.py
index 3c5f026..21a772c 100755 (executable)
--- a/mlp.py
+++ b/mlp.py
@@ -61,7 +61,7 @@ agtree2dot.save_dot(loss,
 print('Generated mlp.dot')
 
 try:
-    subprocess.check_call(["dot", "mlp.dot", "-Lg", "-T", "pdf", "-o", "mlp.pdf" ])
+    subprocess.check_call(['dot', 'mlp.dot', '-Lg', '-T', 'pdf', '-o', 'mlp.pdf' ])
 except subprocess.CalledProcessError:
     print('Calling the dot command failed. Is Graphviz installed?')
     sys.exit(1)