diff --git a/cli.py b/cli.py index d10dcbee..0477d01b 100644 --- a/cli.py +++ b/cli.py @@ -1,10 +1,11 @@ import click import json -import matplotlib -matplotlib.use('Agg') # don't show windows -import matplotlib.pyplot as plt +#import matplotlib +#matplotlib.use('Agg') # don't show windows +#import matplotlib.pyplot as plt import networkx as nx import os +import subprocess from x import actions as xa from x import deployment as xd @@ -146,12 +147,17 @@ def init_cli_connections(): @click.command() def graph(): g = xs.connection_graph() - pos = nx.spring_layout(g) - nx.draw_networkx_nodes(g, pos) - nx.draw_networkx_edges(g, pos, arrows=True) - nx.draw_networkx_labels(g, pos) - plt.axis('off') - plt.savefig('graph.png') + + nx.write_dot(g, 'graph.dot') + subprocess.call(['dot', '-Tps', 'graph.dot', '-o', 'graph.ps']) + + # Matplotlib + #pos = nx.spring_layout(g) + #nx.draw_networkx_nodes(g, pos) + #nx.draw_networkx_edges(g, pos, arrows=True) + #nx.draw_networkx_labels(g, pos) + #plt.axis('off') + #plt.savefig('graph.png') connections.add_command(graph) diff --git a/main.yml b/main.yml index e5876ba2..b5673080 100644 --- a/main.yml +++ b/main.yml @@ -16,7 +16,8 @@ - shell: pip install -r /vagrant/requirements.txt # Graph drawing - - apt: name=python-matplotlib state=present + #- apt: name=python-matplotlib state=present + - apt: name=python-graphviz state=present # Setup development env for solar #- shell: python setup.py develop chdir=/vagrant/solar