From: Francois Fleuret Date: Mon, 21 Aug 2017 11:59:35 +0000 (+0200) Subject: Changed the font and node colors. X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;h=21558202134d649b29fb700481b15963e71b1d1f;p=agtree2dot.git Changed the font and node colors. --- diff --git a/agtree2dot.py b/agtree2dot.py index 8cc9e8c..0f787ac 100755 --- a/agtree2dot.py +++ b/agtree2dot.py @@ -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 Binary files a/mlp.pdf and b/mlp.pdf differ diff --git a/mlp.py b/mlp.py index 3c5f026..21a772c 100755 --- 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)