From dde4c9c88235cdf999ab2aa1c0e43094f218ed72 Mon Sep 17 00:00:00 2001 From: nojhan Date: Fri, 22 Jul 2011 22:23:59 +0200 Subject: [PATCH] colors and output --- tsplib.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tsplib.py b/tsplib.py index 47d2cc8..3e01ae1 100644 --- a/tsplib.py +++ b/tsplib.py @@ -134,7 +134,7 @@ def plot_segments( segments ): verts = [start,end,(0,0)] codes = [Path.MOVETO,Path.LINETO,Path.STOP] path = Path(verts, codes) - patch = patches.PathPatch(path, facecolor='none', lw=1) + patch = patches.PathPatch(path, edgecolor='green', lw=1) ax.add_patch(patch) ax.set_xlim(-50,50) @@ -157,7 +157,7 @@ def plot_segments_tour( segments_1, segments_2 ): verts = [start,end,(0,0)] codes = [Path.MOVETO,Path.LINETO,Path.STOP] path = Path(verts, codes) - patch = patches.PathPatch(path, facecolor='0.5', lw=1) + patch = patches.PathPatch(path, edgecolor='blue', lw=1) ax.add_patch(patch) for segment in segments_2: @@ -165,7 +165,7 @@ def plot_segments_tour( segments_1, segments_2 ): verts = [start,end,(0,0)] codes = [Path.MOVETO,Path.LINETO,Path.STOP] path = Path(verts, codes) - patch = patches.PathPatch(path, facecolor='1.0', lw=3) + patch = patches.PathPatch(path, edgecolor='red', lw=2) ax.add_patch(patch) @@ -235,6 +235,8 @@ if __name__=="__main__": with open(ftour,"r") as fd: tour = read_tour_index( fd ) + print tour + print "Build tour segments" tour_segments = [] for i in xrange(0,len(tour)-1):