# CS 4786, Profs Lee and Sridharan, Feb 2015
# using matplotlib to create a scatterplot from two csv files

import matplotlib.pyplot as plt
import numpy as np

orig = np.loadtxt('2d-gaussian.csv', delimiter=',')
rotated = np.loadtxt('2d-gaussian-rotated.csv', delimiter=',')
projector = np.array([[.7071068, .7071068], [.56, 0]])
projected = np.dot(orig,projector)

plt.scatter(orig[:,0], orig[:,1], color='red', label='original')
plt.scatter(rotated[:,0], rotated[:,1], color='green', label='rotated')
plt.scatter(projected[:,0], projected[:,1], color='blue', label='projected but not rotated')

legend = plt.legend(loc='upper right')

# set ranges of x and y axes
plt.xlim([-12,12])
plt.ylim([-12,12])
# show the x and y axes
plt.axhline(0, color='gray')
plt.axvline(0, color='gray')


plt.show()

# used gnuplot to generate class fig, but this command shows students how
# to save their own figures

#plt.savefig('2dgaussian.pdf')