from math import pi
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd


def xc(a, om1, phi1, t):
    return a*np.cos(om1*t + phi1)

def yc(b, om2, phi2, t):
    return b*np.sin(om2*t + phi2)

a = 1.
b = 1.
om1 = 1.
om2 = 2.
phi1 = 0. #np.pi/2.
phi2 = 0.
T = 360
n_steps = 360
t = np.linspace(0. ,T , n_steps)/T*2*pi



fig, ax = plt.subplots()
d = 1.2*max(a,b)
ax.set_xlim(-d, d)
ax.set_ylim(-d, d)
ax.plot(xc(a, om1, phi1, t)[0], yc(b, om2, phi2, t)[0], 'ko')
ax.plot(xc(a, om1, phi1, t), yc(b, om2, phi2, t), 'k-')
ax.set_title(r'$(x, y) = ({:.0f}\cdot \cos({:.0f} t + {:.0f}), {:.0f}\cdot \sin({:.0f} t + {:.0f})$'.format(a, om1, phi1, b, om2, phi2))
#line, = ax.plot(xc(r, nx, t), yc(r, ny, t))
plt.gca().set_aspect('equal', adjustable='box')
ax.set_xlabel('x',fontsize=14)
ax.set_ylabel('y',fontsize=14)
plt.savefig('lissajous-plot.eps',bbox_inches='tight')
#plt.show()
