Project 2 for MA132
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

27 lines
603 B

#!/usr/bin/python3
import pylab
import os
files = sorted(os.listdir("data/"))
simulations = {}
for file in files:
population = []
with open("data/" + file, "r") as f:
for line in f.readlines():
population.append(int(line.split()[1]))
simulations.update({file.strip(".dat"): population})
print(simulations.keys())
t = pylab.arange(1, 3649, 1)
for key in simulations.keys():
s = [i**2 for i in simulations[key]]
pylab.plot(t, s, color="purple")
pylab.xlabel('Days')
pylab.ylabel('Population')
pylab.title('Stink Bug Population')
pylab.grid(True)
pylab.show()