@@ -848,7 +848,10 @@ def gen_candidates():
848848_obsolete_set = {'plugins.directory' , 'text.dvipnghack' }
849849
850850# The following may use a value of None to suppress the warning.
851- _deprecated_set = {'axes.hold' } # do NOT include in _all_deprecated
851+ # do NOT include in _all_deprecated
852+ _deprecated_set = {'axes.hold' ,
853+ 'backend.qt4' ,
854+ 'backend.qt5' }
852855
853856_all_deprecated = set (itertools .chain (
854857 _deprecated_ignore_map , _deprecated_map , _obsolete_set ))
@@ -872,6 +875,10 @@ class RcParams(MutableMapping, dict):
872875 msg_depr_ignore = "%s is deprecated and ignored. Use %s instead."
873876 msg_obsolete = ("%s is obsolete. Please remove it from your matplotlibrc "
874877 "and/or style files." )
878+ msg_backend_obsolete = ("The {} rcParam was deprecated in version 2.2. In"
879+ " order to force the use of a specific Qt binding,"
880+ " either import that binding first, or set the "
881+ "QT_API environment variable." )
875882
876883 # validate values on the way in
877884 def __init__ (self , * args , ** kwargs ):
@@ -886,8 +893,12 @@ def __setitem__(self, key, val):
886893 key = alt_key
887894 val = alt_val (val )
888895 elif key in _deprecated_set and val is not None :
889- warnings .warn (self .msg_depr_set % key ,
890- mplDeprecation )
896+ if key .startswith ('backend' ):
897+ warnings .warn (self .msg_backend_obsolete .format (key ),
898+ mplDeprecation )
899+ else :
900+ warnings .warn (self .msg_depr_set % key ,
901+ mplDeprecation )
891902 elif key in _deprecated_ignore_map :
892903 alt = _deprecated_ignore_map [key ]
893904 warnings .warn (self .msg_depr_ignore % (key , alt ),
0 commit comments