10000 Merge pull request #16336 from timhoffm/lines-example · matplotlib/matplotlib@f857586 · GitHub
[go: up one dir, main page]

Skip to content

Commit f857586

Browse files
authored
Merge pull request #16336 from timhoffm/lines-example
Include axline() in infinite lines example
2 parents 182c2f2 + da7eff4 commit f857586

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

examples/pyplots/axline.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
"""
2-
======================================
3-
Infinite horizontal and vertical lines
4-
======================================
2+
==============
3+
Infinite lines
4+
==============
55
66
`~.axes.Axes.axvline` and `~.axes.Axes.axhline` draw infinite vertical /
77
horizontal lines, at given *x* / *y* positions. They are usually used to mark
88
special data values, e.g. in this example the center and limit values of the
99
sigmoid function.
10+
11+
`~.axes.Axes.axline` draws infinite straight lines in arbitrary directions.
1012
"""
1113
import numpy as np
1214
import matplotlib.pyplot as plt
@@ -18,6 +20,7 @@
1820
plt.axhline(y=0.5, color="black", linestyle=":")
1921
plt.axhline(y=1.0, color="black", linestyle="--")
2022
plt.axvline(color="grey")
23+
plt.axline((0, 0.5), (2, 1), color="black", linestyle=(0, (5, 5)))
2124
plt.plot(t, sig, linewidth=2, label=r"$\sigma(t) = \frac{1}{1 + e^{-t}}$")
2225
plt.xlim(-10, 10)
2326
plt.xlabel("t")
@@ -37,5 +40,7 @@
3740
import matplotlib
3841
matplotlib.pyplot.axhline
3942
matplotlib.pyplot.axvline
43+
matplotlib.pyplot.axline
4044
matplotlib.axes.Axes.axhline
4145
matplotlib.axes.Axes.axvline
46+
matplotlib.axes.Axes.axline

0 commit comments

Comments
 (0)
0