Example #1
0
def plot_tree(clf, dot_file):
    with open(dot_file, 'w') as fout:
        export_graphviz(clf, out_file=fout)
    d = graph_from_dot_file(dot_file)
    filepath = dot_file[:-4]
    d.write_ps(filepath + '.jpg')
    d.write_png(filepath + '.ps')
    d.write_pdf(filepath + '.pdf')
Example #2
0
def write_graph_as_image(path, filename, fw):
    if '--write-image' not in sys.argv:
        return
    path.mkdir(True)
    out = path.child(str(filename))
    fw.write_dot(out + '.dot')
    g = graphviz.graph_from_dot_file(out + '.dot')
    g.write_png(out + '.png')
Example #3
0
# @copyright 2016, Xerox Corporation (Xerox)and Palo Alto Research Center (PARC).  All rights reserved.
#
# This script reads the dot file and builds athena connections based on specified topology

import argparse
import subprocess
from pydotplus.graphviz import graph_from_dot_file

# Build argument parser (and help)
argparser = argparse.ArgumentParser(description='Build links between nodes according to a dotfile graph description.')
argparser.add_argument('dotfile', metavar='DOTFILE', help='The DOT file containing the graph/network description')

args = argparser.parse_args()

print('Parsing dot file (' + args.dotfile + ')...')
graph = graph_from_dot_file(args.dotfile)

# Setup dircetory variables
keyfileName = 'keyfile'
password = '******'

import sys
import os
try:
    build_dir = os.environ['CCNX_HOME']
except KeyError:
    print "You must set a CCNX_HOME environment variable to the location of your CCNx build directory."
    print "Exiting ..."
    sys.exit(1)

athena = build_dir + '/bin/athena'
Example #4
0
import subprocess
from pydotplus.graphviz import graph_from_dot_file

# Build argument parser (and help)
argparser = argparse.ArgumentParser(
    description=
    'Build links between nodes according to a dotfile graph description.')
argparser.add_argument(
    'dotfile',
    metavar='DOTFILE',
    help='The DOT file containing the graph/network description')

args = argparser.parse_args()

print('Parsing dot file (' + args.dotfile + ')...')
graph = graph_from_dot_file(args.dotfile)

# Setup dircetory variables
keyfileName = 'keyfile'
password = '******'

import sys
import os
try:
    build_dir = os.environ['CCNX_HOME']
except KeyError:
    print "You must set a CCNX_HOME environment variable to the location of your CCNx build directory."
    print "Exiting ..."
    sys.exit(1)

athena = build_dir + '/bin/athena'