import matplotlib.pyplot as plt

import numpy as np

import os


f = os.walk('.')

print f 



colours = ['','r','b','g','orange','r','k','y']

i = 0

for root, dirs, files in f:
    
    legend = 0
    
    for f in files:
        
        if 'dat' in f:
            print root
            
            data = np.genfromtxt(root+'/'+f)
            
            
            if legend == 0:
                plt.plot(data[:,0], data[:,1], c = colours[i], label = root.split('/')[1])
                legend = 1
            else:
                plt.plot(data[:,0], data[:,1], c = colours[i])
    
    i+=1

plt.legend()
plt.show()
