Skip to content

Commit b2d14fd

Browse files
committed
Remove deprecated rcParams.
1 parent 4dbbd22 commit b2d14fd

File tree

4 files changed

+20
-38
lines changed

4 files changed

+20
-38
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Removed rcParams
2+
````````````````
3+
4+
The following deprecated rcParams are removed:
5+
6+
- ``text.dvipnghack``,
7+
- ``nbagg.transparent`` (use :rc:`figure.facecolor` instead),
8+
- ``plugins.directory``,
9+
- ``axes.hold``,
10+
- ``backend.qt4`` and ``backend.qt5`` (set the :envvar:`QT_API` environment
11+
variable instead).

lib/matplotlib/__init__.py

+1-13
Original file line numberDiff line numberDiff line change
@@ -739,19 +739,13 @@ def gen_candidates():
739739
# rcParams deprecated; some can manually be mapped to another key.
740740
# Values are tuples of (version, new_name_or_None).
741741
_deprecated_ignore_map = {
742-
'text.dvipnghack': ('2.1', None),
743-
'nbagg.transparent': ('2.2', 'figure.facecolor'),
744-
'plugins.directory': ('2.2', None),
745742
'pgf.debug': ('3.0', None),
746743
}
747744

748745
# rcParams deprecated; can use None to suppress warnings; remain actually
749746
# listed in the rcParams (not included in _all_deprecated).
750747
# Values are tuples of (version,)
751748
_deprecated_remain_as_none = {
752-
'axes.hold': ('2.1',),
753-
'backend.qt4': ('2.2',),
754-
'backend.qt5': ('2.2',),
755749
'text.latex.unicode': ('3.0',),
756750
}
757751

@@ -815,14 +809,8 @@ def __setitem__(self, key, val):
815809
val = alt_val(val)
816810
elif key in _deprecated_remain_as_none and val is not None:
817811
version, = _deprecated_remain_as_none[key]
818-
addendum = ''
819-
if key.startswith('backend'):
820-
addendum = (
821-
"In order to force the use of a specific Qt binding, "
822-
"either import that binding first, or set the QT_API "
823-
"environment variable.")
824812
cbook.warn_deprecated(
825-
"2.2", name=key, obj_type="rcparam", addendum=addendum)
813+
version, name=key, obj_type="rcparam")
826814
elif key in _deprecated_ignore_map:
827815
version, alt_key = _deprecated_ignore_map[key]
828816
cbook.warn_deprecated(

lib/matplotlib/backends/qt_compat.py

+8-19
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44
The selection logic is as follows:
55
- if any of PyQt5, PySide2, PyQt4 or PySide have already been imported
66
(checked in that order), use it;
7-
- otherwise, if the QT_API environment variable (used by Enthought) is
8-
set, use it to determine which binding to use (but do not change the
9-
backend based on it; i.e. if the Qt4Agg backend is requested but QT_API
10-
is set to "pyqt5", then actually use Qt4 with the binding specified by
11-
``rcParams["backend.qt4"]``;
7+
- otherwise, if the QT_API environment variable (used by Enthought) is set, use
8+
it to determine which binding to use (but do not change the backend based on
9+
it; i.e. if the Qt5Agg backend is requested but QT_API is set to "pyqt4",
10+
then actually use Qt5 with PyQt5 or PySide2 (whichever can be imported);
1211
- otherwise, use whatever the rcParams indicate.
1312
"""
1413

@@ -33,31 +32,21 @@
3332
# First, check if anything is already imported.
3433
if "PyQt5" in sys.modules:
3534
QT_API = QT_API_PYQT5
36-
dict.__setitem__(rcParams, "backend.qt5", QT_API)
3735
elif "PySide2" in sys.modules:
3836
QT_API = QT_API_PYSIDE2
39-
dict.__setitem__(rcParams, "backend.qt5", QT_API)
4037
elif "PyQt4" in sys.modules:
4138
QT_API = QT_API_PYQTv2
42-
dict.__setitem__(rcParams, "backend.qt4", QT_API)
4339
elif "PySide" in sys.modules:
4440
QT_API = QT_API_PYSIDE
45-
dict.__setitem__(rcParams, "backend.qt4", QT_API)
4641
# Otherwise, check the QT_API environment variable (from Enthought). This can
4742
# only override the binding, not the backend (in other words, we check that the
4843
# requested backend actually matches).
4944
elif rcParams["backend"] in ["Qt5Agg", "Qt5Cairo"]:
50-
if QT_API_ENV == "pyqt5":
51-
dict.__setitem__(rcParams, "backend.qt5", QT_API_PYQT5)
52-
elif QT_API_ENV == "pyside2":
53-
dict.__setitem__(rcParams, "backend.qt5", QT_API_PYSIDE2)
54-
QT_API = dict.__getitem__(rcParams, "backend.qt5")
45+
if QT_API_ENV in ["pyqt5", "pyside2"]:
46+
QT_API = _ETS[QT_API_ENV]
5547
elif rcParams["backend"] in ["Qt4Agg", "Qt4Cairo"]:
56-
if QT_API_ENV == "pyqt4":
57-
dict.__setitem__(rcParams, "backend.qt4", QT_API_PYQTv2)
58-
elif QT_API_ENV == "pyside":
59-
dict.__setitem__(rcParams, "backend.qt4", QT_API_PYSIDE)
60-
QT_API = dict.__getitem__(rcParams, "backend.qt4")
48+
if QT_API_ENV in ["pyqt4", "pyside"]:
49+
QT_API = _ETS[QT_API_ENV]
6150
# A non-Qt backend was selected but we still got there (possible, e.g., when
6251
# fully manually embedding Matplotlib in a Qt app without using pyplot).
6352
else:

lib/matplotlib/rcsetup.py

-6
Original file line numberDiff line numberDiff line change
@@ -982,13 +982,10 @@ def _validate_linestyle(ls):
982982
defaultParams = {
983983
'backend': [_auto_backend_sentinel, validate_backend],
984984
'backend_fallback': [True, validate_bool],
985-
'backend.qt4': [None, validate_qt4],
986-
'backend.qt5': [None, validate_qt5],
987985
'webagg.port': [8988, validate_int],
988986
'webagg.address': ['127.0.0.1', validate_webagg_address],
989987
'webagg.open_in_browser': [True, validate_bool],
990988
'webagg.port_retries': [50, validate_int],
991-
'nbagg.transparent': [True, validate_bool],
992989
'toolbar': ['toolbar2', validate_toolbar],
993990
'datapath': [None, validate_path_exists], # handled by
994991
# _get_data_path_cached
@@ -1117,7 +1114,6 @@ def _validate_linestyle(ls):
11171114
'text.latex.unicode': [True, validate_bool],
11181115
'text.latex.preamble': [[], validate_stringlist],
11191116
'text.latex.preview': [False, validate_bool],
1120-
'text.dvipnghack': [None, validate_bool_maybe_none],
11211117
'text.hinting': ['auto', validate_hinting],
11221118
'text.hinting_factor': [8, validate_int],
11231119
'text.antialiased': [True, validate_bool],
@@ -1401,8 +1397,6 @@ def _validate_linestyle(ls):
14011397

14021398
# set this when you want to generate hardcopy docstring
14031399
'docstring.hardcopy': [False, validate_bool],
1404-
# where plugin directory is locate
1405-
'plugins.directory': ['.matplotlib_plugins', validate_string],
14061400

14071401
'path.simplify': [True, validate_bool],
14081402
'path.simplify_threshold': [1.0 / 9.0, ValidateInterval(0.0, 1.0)],

0 commit comments

Comments
 (0)