In [ ]:
import numpy as np
import matplotlib.pyplot as plt
hoL = np.arange(0, 1, 0.001)
kh = 2 * np.pi * hoL
tanhkh = np.tanh(kh)
threshold = 1e-3
one = (1 - tanhkh) <= threshold
equal = (kh - tanhkh) <= threshold
fig, ax = plt.subplots(figsize=(8, 4))
ax.plot(hoL, tanhkh, color='#493D26', linewidth='2', label=r"$\tanh(kh)$")
ax.plot(hoL[equal], tanhkh[equal], color='#F88017', linewidth='3', label=r"$\tanh(kh) \sim kh$")
ax.plot(hoL[one], tanhkh[one], color='#168EF7', linewidth='3', label=r"$\tanh(kh) \sim 1$")
ax.set_xlabel(r'$\frac{h}{L}$')
ax.set_ylabel(r'$\tanh(kh)$')
ax.axis([0, 1, 0, 1.05])
_ = ax.legend(loc='lower right')