import matplotlib.pyplot as plt
import numpy as np
xs1 = np.linspace(0.0001, 1.2, 100)
xs2 = np.linspace(-1.2, -0.0001, 100)
blue="#007ec1"
orange="#d77a5a"
green="#6e8334"
fs = 13
plt.axis("off")
plt.axhline(color="black")
plt.axvline(color="black")
plt.ylim((-1.2, 1.2))
plt.plot(xs1, np.sign(xs1), color=blue)
plt.plot(xs2, np.sign(xs2), color=blue)
plt.plot([0], [0], "o", color=blue)
plt.plot([0], [1], "o", markerfacecolor="white", color=blue)
plt.plot([0], [-1], "o", markerfacecolor="white", color=blue)
plt.plot([0], [0], "o", color=blue)
plt.text(-1.45, -0.17, "$\operatorname{sgn}\left(\lim_{n\\to\infty}\ \\frac{1}{n}\\right) = \operatorname{sgn}(0)=0$", color=blue, fontsize=fs)
plt.text(-0.9, 1.1, "$\lim_{n\\to\infty}\ \operatorname{sgn}\left(\\frac{1}{n}\\right) =1$", color=orange, fontsize=fs)
for n in range(1,6):
plt.plot([1./n, 1./n], [0, 1], "--", color="black")
plt.plot([1./n], [1], "o", color=orange)
plt.plot([1./n], [0], "o", color=green)
plt.text(0.3, 1.1, '$\operatorname{sgn}\left(\\frac{1}{n}\\right)$', color=orange, fontsize=fs)
plt.text(0.47, -0.17, "$\\frac{1}{n}$", color=green, fontsize=fs)
plt.text(0.04, 0.5, "...", fontsize=fs-4)
plt.arrow(0.22,1.05,-0.15,0, color=orange, linewidth=1, head_width=0.03)
plt.arrow(0.22,-0.05,-0.15,0, color=green, linewidth=1, head_width=0.03)
plt.arrow(-0.55,0.57,0,0.4, color="black", head_width=0.03)
plt.arrow(-0.55,0.43,0,-0.35, color="black", head_width=0.03)
plt.text(-0.6,0.46, u'\u2260', fontsize=fs-4, color="black")
plt.savefig("Discontinuity of the sign function at 0.svg", transparent=True, bbox_inches="tight", pad_inches=0.05)