summaryrefslogtreecommitdiff
path: root/doc/source/reference
diff options
context:
space:
mode:
authorTim Hoffmann <2836374+timhoffm@users.noreply.github.com>2021-03-20 03:30:24 +0100
committerTim Hoffmann <2836374+timhoffm@users.noreply.github.com>2021-03-21 22:32:52 +0100
commitbfb5e9f3450b5ecc19c1093b3f09e61037588ede (patch)
treeba8035daa3b1ac5348efac8a626aadd0ffe0c9d0 /doc/source/reference
parentf282603bf1c210e44ffc34e6a464c17a4851a58a (diff)
downloadnumpy-bfb5e9f3450b5ecc19c1093b3f09e61037588ede.tar.gz
DOC: Update some plotting code to current Matplotlib idioms
- 3D Axes are created via add_subplot(projection='3d') - There is now a `stairs()` function that's specifically designed for showing histogram curves - Labels should be passed as keyword arguments to the plot functions instead of to `legend()`, which reduces the risk of mixing them up. - ensure equal axis scaling in the meshgrid example
Diffstat (limited to 'doc/source/reference')
-rw-r--r--doc/source/reference/routines.polynomials.classes.rst6
1 files changed, 4 insertions, 2 deletions
diff --git a/doc/source/reference/routines.polynomials.classes.rst b/doc/source/reference/routines.polynomials.classes.rst
index 10331e9c1..5f575bed1 100644
--- a/doc/source/reference/routines.polynomials.classes.rst
+++ b/doc/source/reference/routines.polynomials.classes.rst
@@ -290,7 +290,8 @@ polynomials up to degree 5 are plotted below.
>>> import matplotlib.pyplot as plt
>>> from numpy.polynomial import Chebyshev as T
>>> x = np.linspace(-1, 1, 100)
- >>> for i in range(6): ax = plt.plot(x, T.basis(i)(x), lw=2, label="$T_%d$"%i)
+ >>> for i in range(6):
+ ... ax = plt.plot(x, T.basis(i)(x), lw=2, label=f"$T_{i}$")
...
>>> plt.legend(loc="upper left")
<matplotlib.legend.Legend object at 0x3b3ee10>
@@ -304,7 +305,8 @@ The same plots over the range -2 <= `x` <= 2 look very different:
>>> import matplotlib.pyplot as plt
>>> from numpy.polynomial import Chebyshev as T
>>> x = np.linspace(-2, 2, 100)
- >>> for i in range(6): ax = plt.plot(x, T.basis(i)(x), lw=2, label="$T_%d$"%i)
+ >>> for i in range(6):
+ ... ax = plt.plot(x, T.basis(i)(x), lw=2, label=f"$T_{i}$")
...
>>> plt.legend(loc="lower right")
<matplotlib.legend.Legend object at 0x3b3ee10>