Moved the font specification to the dot command line arguments.
authorFrancois Fleuret <francois@fleuret.org>
Thu, 31 Aug 2017 13:03:35 +0000 (15:03 +0200)
committerFrancois Fleuret <francois@fleuret.org>
Thu, 31 Aug 2017 13:03:35 +0000 (15:03 +0200)
agtree2dot.py
mlp.pdf
mlp.py

index 4eef05a..24d5f85 100755 (executable)
@@ -103,10 +103,6 @@ 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]
 
diff --git a/mlp.pdf b/mlp.pdf
index ee3ebb3..a72a3b7 100644 (file)
Binary files a/mlp.pdf and b/mlp.pdf differ
diff --git a/mlp.py b/mlp.py
index 21a772c..963e7b7 100755 (executable)
--- a/mlp.py
+++ b/mlp.py
@@ -61,7 +61,14 @@ agtree2dot.save_dot(loss,
 print('Generated mlp.dot')
 
 try:
-    subprocess.check_call(['dot', 'mlp.dot', '-Lg', '-T', 'pdf', '-o', 'mlp.pdf' ])
+    fontname='Computer Modern'
+    fontsize=12
+    subprocess.check_call(['dot', 'mlp.dot',
+                           '-Lg',
+                           '-T', 'pdf',
+                           '-Efontname=' + fontname, '-Efontsize=' + str(fontsize),
+                           '-Nfontname=' + fontname, '-Nfontsize=' + str(fontsize),
+                           '-o', 'mlp.pdf' ])
 except subprocess.CalledProcessError:
     print('Calling the dot command failed. Is Graphviz installed?')
     sys.exit(1)