diff scripts/score_individual.py @ 209:538322113524 Dev_main

Merge from the default branch
author Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk>
date Tue, 16 Jun 2015 14:14:08 +0100
parents 59eea6eed91b
children
line wrap: on
line diff
--- a/scripts/score_individual.py	Thu Jun 11 10:06:58 2015 +0100
+++ b/scripts/score_individual.py	Tue Jun 16 14:14:08 2015 +0100
@@ -8,9 +8,12 @@
 colormap = ['b', 'r', 'g', 'c', 'm', 'y', 'k'] # colormap for to cycle through
 markerlist = ["x", ".", "o", "*", "+", "v", ">", "<", "8", "s", "p"]
 
+show_legend = False
+
 # get every csv file in folder
 for file in os.listdir(rating_folder):
     if file.endswith(".csv"):
+        
         page_name = file[:-4] # file name (without extension) is page ID
 
         with open(rating_folder+file, 'r') as readfile: # read this csv file
@@ -34,7 +37,7 @@
                         )
                 increment += 1 # increase counter
                 linehandles.append(plothandle)
-                legendnames.append(subject_id)
+                legendnames.append(subject_id.decode("utf-8")) # avoid decoding problems
 
 
             plt.xlabel('Fragment')
@@ -45,16 +48,18 @@
             plt.ylabel('Rating')
             plt.ylim(0,1)
 
-            plt.legend(linehandles, legendnames,
-                       loc='upper right',
-                       bbox_to_anchor=(1.1, 1),
-                       borderaxespad=0.,
-                       numpoints=1 # remove extra marker
-                       )
+            if show_legend:
+                plt.legend(linehandles, legendnames,
+                           loc='upper right',
+                           bbox_to_anchor=(1.1, 1),
+                           borderaxespad=0.,
+                           numpoints=1 # remove extra marker
+                           )
 
             #TODO Put legend outside of box
 
             #plt.show() # show plot
             #exit()
-
+            
             plt.savefig(rating_folder+page_name+"-ind.png")
+            plt.close()