# -*- coding: utf-8 -*-
#
# Script to generate an asymptote curve.
#
# **************************************************************
# Example of a curve with its asymptote
# shows that the curve may intersect the asymptote,
# in this case an infinite amount of times.
# **************************************************************
#
# Guillaume Jacquenot
# 2013 03 20
import numpy as np
import matplotlib
from matplotlib.pyplot import figure, show, rc, grid
def makePlot(outputFilename = r'Asymptote02.svg'):
rc('grid', linewidth = 1, linestyle = '-', color = '#a0a0a0')
rc('xtick', labelsize = 15)
rc('ytick', labelsize = 15)
rc('font',**{'family':'serif','serif':['Palatino'],'size':15})
rc('text', usetex=True)
fig = figure()
ax = fig.add_axes([0.12, 0.12, 0.76, 0.76])#axisbg='#d5de9c'
n = 14
t = np.arange(0.07,12.0,0.01)
x = t + np.cos(n*t)/t
y = t + np.sin(n*t)/t
ax.plot(x, y, color='#ee8d18', lw = 2)
ax.plot([-4,12], [-4,12], lw = 1, ls = '--', color = 'k')
ax.set_aspect('equal')
grid(True)
ax.set_xlabel('$x$')
ax.set_ylabel('$y$',rotation=0)
ax.set_title(r'$x=t+\frac{\cos(nt)}{t}, y=t+\frac{\sin(nt)}{t}, t>0, n = '+str(n)+r'$',
fontsize=15)
fig.savefig(outputFilename)
fig.show()
makePlot()