diff --git a/examples/pyplots/axline.py b/examples/pyplots/axline.py index 73eed0752c7d..713b23aee6fd 100644 --- a/examples/pyplots/axline.py +++ b/examples/pyplots/axline.py @@ -1,12 +1,14 @@ """ -====================================== -Infinite horizontal and vertical lines -====================================== +============== +Infinite lines +============== `~.axes.Axes.axvline` and `~.axes.Axes.axhline` draw infinite vertical / horizontal lines, at given *x* / *y* positions. They are usually used to mark special data values, e.g. in this example the center and limit values of the sigmoid function. + +`~.axes.Axes.axline` draws infinite straight lines in arbitrary directions. """ import numpy as np import matplotlib.pyplot as plt @@ -18,6 +20,7 @@ plt.axhline(y=0.5, color="black", linestyle=":") plt.axhline(y=1.0, color="black", linestyle="--") plt.axvline(color="grey") +plt.axline((0, 0.5), (2, 1), color="black", linestyle=(0, (5, 5))) plt.plot(t, sig, linewidth=2, label=r"$\sigma(t) = \frac{1}{1 + e^{-t}}$") plt.xlim(-10, 10) plt.xlabel("t") @@ -37,5 +40,7 @@ import matplotlib matplotlib.pyplot.axhline matplotlib.pyplot.axvline +matplotlib.pyplot.axline matplotlib.axes.Axes.axhline matplotlib.axes.Axes.axvline +matplotlib.axes.Axes.axline