Now that its working like this way so I need to save them automatically in .eps format as an increment like 1.eps, 2.eps. Another thing, is there a way I can put the output of y like [1 1 1 1 1 1] on top of the each plot? I am quite new to python and thats why I am still trying to learn the things. The 3phases.txt file consists of 3 lines
1   1   1, 
1   -1  1, 
-1  -1  -1
The code again:
import matplotlib.pyplot as plt
import numpy as np
D=13.0
n = range(1,7)
x = np.linspace(-0.3-D/2, 0.3+D/2, 3000)
q = np.array([0, 4.38,  12.61,  3.63,  0,  6.39])
f = open('3phases.txt','r')
for line in f.readlines():  
    line = line.split()
    line.insert(0, '1')
    line.insert(3, '1')
    line.insert(4, '1')
    t=map(float,line)
    y = np.array(t*q)
    d=sum(l*np.cos(2*np.pi*j*x/D) for j,l in zip(n,y)) 
    fig, ax = plt.subplots()
    ax.plot(x, d, 'ro')
plt.show()
 
     
     
    