I want to loop over two files and plot the first column versus the second column of each file next to each other. I write the script below to do that, but after running, the two diagrams are plotted in one figure, while I want to plot them in two separate diagrams next to each other.
Can someone help me out with how to fix my code regarding my purpose?
def plot_en(filename):
with open("%s.en" %filename,"r") as g_in:
t=[]
for line in g_in:
t.append([ float(x) for x in line.split()])
column1 = [ x[0] for x in t]
column2 = [ x[1] for x in t]
plt.plot(column1,column2)
plot_en("tempor1")
plot_en("tempor2")
for example, consider files tempor1.en and tempor2.en are:
tempor1.en:
500 1.1
550 2.1
600 2.2
650 3.1
700 3.9
tempor2.en:
500 3.1
550 3.5
600 3.8
650 4.0
700 4.9
using the above python command I got two diagrams plotted on each other, like this: enter image description here
but I want to have separate diagrams for each of the tempor1.en and tempor2.en files right next to each other.