Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 45b340b

Browse files
committed
deprecate undocumented matplotlib/mpl.py
`matplotlib/mpl.py` is a file which used to get imported via ipython's `%pyplot` interface as module named `mpl`, yet it isn't clear at all what it's role is. Given that in our own code, and in the rest of our python neighborhood, we often do `import matplotlib as mpl`, it's quite a bit confusing to have something with the `mpl` name within matplotlib not be the `matplotlib` module itself. This module was only used in `pylab` interface, where it was simply imported in one line via `from matplotlib import mpl` and never used again. With the exception of mpl.finance, all of the modules in mpl.py were readily available simply via "import matplotlib as mpl". pylab's mpl.finance functionality is retained for backwards compatability.
1 parent a1f8b4e commit 45b340b

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

CHANGELOG

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2+
2012-11-26 deprecate matplotlib/mpl.py, which was used only in pylab.py and is
3+
now replaced by the more suitable `import matplotlib as mpl`. - PI
4+
15
2012-11-13 Add a symmetric log normalization class to colors.py.
26
Also added some tests for the normalization class.
37
Till Stensitzki

lib/matplotlib/mpl.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
import warnings
2+
warnings.warn(
3+
"matplotlib.mpl is deprecated and will be removed in the next release."
4+
"Please use `import matplotlib as mpl` instead",
5+
DeprecationWarning)
16
from matplotlib import artist
27
from matplotlib import axis
38
from matplotlib import axes

lib/matplotlib/pylab.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,10 @@
219219
from cbook import flatten, is_string_like, exception_to_str, \
220220
silent_list, iterable, dedent
221221

222-
from matplotlib import mpl # pulls in most modules
222+
import matplotlib as mpl
223+
# make mpl.finance module available for backwards compatability, in case folks
224+
# using pylab interface depended on not having to import it
225+
import matplotlib.finance
223226

224227
from matplotlib.dates import date2num, num2date,\
225228
datestr2num, strpdate2num, drange,\

0 commit comments

Comments
 (0)