Skip to content

Commit 2ac7b88

Browse files
ivanovdmcdougall
authored andcommitted
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 c8aca3b commit 2ac7b88

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
@@ -17,6 +17,9 @@
1717
This allows backends to utilize additional text attributes, like
1818
the alignment of text elements. - pwuertz
1919

20+
2012-11-26 deprecate matplotlib/mpl.py, which was used only in pylab.py and is
21+
now replaced by the more suitable `import matplotlib as mpl`. - PI
22+
2023
2012-11-16 plt.set_cmap no longer throws errors if there is not already
2124
an active colorable artist, such as an image, and just sets
2225
up the colormap to use from that point forward. - PI
@@ -27,6 +30,7 @@
2730
color so that any alpha set by markerfacecolor will respected.
2831
- Thomas Caswell
2932

33+
>>>>>>> deprecate undocumented `matplotlib/mpl.py`
3034
2012-11-13 Add a symmetric log normalization class to colors.py.
3135
Also added some tests for the normalization class.
3236
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 matplotlib.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)