8000 Merge pull request #27481 from shriyakalakata/pylab_docs · matplotlib/matplotlib@444d042 · GitHub
[go: up one dir, main page]

Skip to content

Commit 444d042

Browse files
authored
Merge pull request #27481 from shriyakalakata/pylab_docs
Fixing Pylab documentation in API interface overview
2 parents da1d766 + 6c2b5ad commit 444d042

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

galleries/users_explain/figure/api_interfaces.rst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,11 @@ Appendix: "pylab" interface
285285
---------------------------
286286

287287
There is one further interface that is highly discouraged, and that is to
288-
basically do ``from matplotlib.pyplot import *``. This allows users to simply
289-
call ``plot(x, y)``. While convenient, this can lead to obvious problems if the
290-
user unwittingly names a variable the same name as a pyplot method.
288+
basically do ``from matplotlib.pylab import *``. This imports all the
289+
functions from ``matplotlib.pyplot``, ``numpy``, ``numpy.fft``, ``numpy.linalg``, and
290+
``numpy.random``, and some additional functions into the global namespace.
291+
292+
Such a pattern is considered bad practice in modern python, as it clutters
293+
the global namespace. Even more severely, in the case of ``pylab``, this will
294+
overwrite some builtin functions (e.g. the builtin ``sum`` will be replaced by
295+
``numpy.sum``), which can lead to unexpected behavior.

0 commit comments

Comments
 (0)
0