plotPareto.py 1.33 KB
import numpy as np
import matplotlib.pyplot as plt


#val = input("1:WoodYield/SoilLoss \n 2:WoodYield/RiskPercentile \n 3:SoilLoss/RiskPercentile \n 4:All three

f=open("paretoWS.csv","r")
#lines=sorted(list(map(str, f.readlines())))

f2 =open("nonParetoWS.csv","r")
#lines2 = sorted(list(map(str, f2.readlines())))

lines=f.readlines()
lines2 = f2.readlines()



x = []
y = []
lst = []
scatterx = []
scattery = []

for i in lines:
	result = i.split(',')
	x.append(int(result[0]))
	y.append(int(result[1]))
	lst.append([int(result[0]),int(result[1])])
f.close()


lim = 0
for j in lines2:
	lim = lim + 1
	#if(lim == 200):
		#break
	result = j.split(',')
	if([int(result[0]), [int(result[1])]] in lst):
		continue
	else:
		scatterx.append(int(result[0]))
		scattery.append(int(result[1]))

f2.close()


xmin = str(int(min(x)) - 1000)
xmax = str(int(max(x)) + 1000)
ymin = str(int(min(y)) - 1000)
ymax = str(int(max(y)) + 1000)

plt.figure(figsize=(100,100))


plt.scatter(scatterx, scattery, marker = 'x', color = 'r', label = "non-pareto")
plt.scatter(x, y, label = 'pareto frontier')
#plt.plot(x, y)
#plt.plot(x, y, linestyle='--', marker = 'o', color = 'b', label = 'pareto frontier')


#plt.xlim([xmin, xmax])
#plt.ylim([ymin, ymax])

#plt.xticks(x[::10],  rotation='vertical')
#plt.yticks(y[::10],  rotation='horizontal')



plt.legend()
plt.show()