#Plot!
sns.set()
fig = plt.figure(figsize = (10, 10))
ax = fig.add_subplot(111, xlim = (-50, 50), ylim = (-50, 50))
#Remove axes and ticks.
for side in ['bottom', 'left', 'top', 'right']:
ax.spines[side].set_visible(False)
ax.axes.xaxis.set_ticklabels([])
ax.axes.yaxis.set_ticklabels([]);
x1 = -5
y1 = -20
x2 = 5
y2 = 0
mx = (x1+x2)/2
my = (y1+y2)/2
dx = x2-x1
dy = y2-y1
m = dy/dx
#Line.
xn = []
for x in range(-4000, 0):
xn.append(x/100)
yn = []
for x in xn :
y = (y2*(x-x1)**2 - y1*(x-x2)**2) / ((x1**2 - x2**2) - 2*x*(x1 - x2))
yn.append(y)
xp = []
for x in range(1, 5001):
xp.append(x/100)
yp = []
for x in xp :
y = (y2*(x-x1)**2 - y1*(x-x2)**2) / ((x1**2 - x2**2) - 2*x*(x1 - x2))
yp.append(y)
#I. Graph
ax.plot(xn, yn, color = "#73D055", lw = 3, zorder = 1)
ax.plot(xp, yp, color = "#73D055", lw = 3, zorder = 1)
ax.scatter([x1, x2], [y1, y2], color = "#481567", s = 75, zorder = 2)
ax.annotate("(x1, y1)", (x1-8, y1-8), color = "#481567", fontsize = 16)
ax.annotate("(x2, y2)", (x2-2, y2+6), color = "#481567", fontsize = 16)
#III. Vertical Asymptote.
ax.axvline(x = mx, color = "#39568C", ls = ":")
ax.annotate("x = ", (-17, 38), color = "#39568C", fontsize = 16)
ax.annotate("x1 + x2", (-11, 40), color = "#39568C", fontsize = 16)
ax.plot([-10.5, -2.5], [39.2, 39.2], color = "#39568C", lw = 2)
ax.annotate("2", (-7.5, 36.5), color = "#39568C", fontsize = 16)
#III. Oblique Asymptote
ax.plot([mx - 40, mx + 50],
[my - 40*m/2, my + 50*m/2],
color = "#287D8E",
ls = ":")
ax.annotate("m = ", (24, 11), color = "#287D8E", fontsize = 16)
ax.annotate("y2 - y1", (32, 13), color = "#287D8E", fontsize = 16)
ax.plot([30, 42], [12.2, 12.2], color = "#287D8E", lw = 2)
ax.annotate("2(x2 - x1)", (30, 9.5), color = "#287D8E", fontsize = 16)
fig.savefig("2022.02.25 Classic.png")