import matplotlib.pyplot as plt
import numpy as np
# Create a figure of size 8x8 points, 80 dots per inch
plt.figure(figsize=(8,8), dpi=80)
# Draw the limit lines
x = np.linspace(0.001,50.0,1024, endpoint=True)
y = 4.1+0*x
plt.plot(x,y,color="grey", linewidth=1.0, linestyle="--")
y = 3.9+0*x
plt.plot(x,y,color="grey", linewidth=1.0, linestyle="--")
y = 4.0+0*x
plt.plot(x,y,color="grey", linewidth=1.0, linestyle="--")
# Create a plot of the cubic function y = -3*sin(x)/x + 4
x = np.linspace(0.001, 50.0, 1024, endpoint=True)
y = -3*np.sin(x)/x + 4
plt.plot(x,y,color="blue", linewidth=3.0, linestyle="-")
# Set labels
plt.xlim(0.0,50.0)
plt.ylim(0.0,6.0)
# Move the spines
ax = plt.gca()
ax.axhspan(3.9, 4.1, facecolor="yellow", alpha=0.5, linewidth=0)
ax.text(2, 5.0, r'$f(x)=\frac{-3\,\sin(x)}{x}+4$', fontsize=24)
ax.text(45, 0.2, r'$x$', fontsize=24)
ax.text(45, 3.6, r'$2\varepsilon$', fontsize=24)
# Set up the spines
ax.spines['right'].set_color('none')
ax.spines['top'].set_color('none')
ax.xaxis.set_ticks_position('bottom')
ax.spines['bottom'].set_position(('data',0))
ax.yaxis.set_ticks_position('left')
ax.spines['left'].set_position(('data',0))
# Save the figure to the output SVG file
plt.savefig("Limit_Infinity_SVG.svg", bbox_inches="tight")
plt.show()