plotPareto.py 1.18 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=f.readlines()

f2 =open("nonParetoWS.csv","r")
lines2 = f2.readlines()

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

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


lim = 0
for j in lines2:
	lim = lim + 1
	#if(lim == 200):
		#break
	result = j.split(',')
	if([result[0], [result[1]]] in lst):
		continue
	else:
		scatterx.append(result[0])
		scattery.append(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)
#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.margins(0.2)


plt.legend()
plt.show()