File tree 3 files changed +12
-11
lines changed 3 files changed +12
-11
lines changed Original file line number Diff line number Diff line change 43
43
'savefig.directory' , 'tk.window_focus' , 'hardcopy.docstring' ])
44
44
45
45
46
- def _remove_blacklisted_style_params (d ):
46
+ def _remove_blacklisted_style_params (d , warn = True ):
47
47
o = {}
48
48
for key , val in d .items ():
49
49
if key in STYLE_BLACKLIST :
50
- warnings .warn (
51
- "Style includes a parameter, '{0}', that is not related to "
52
- "style. Ignoring" .format (key ))
50
+ if warn :
51
+ warnings .warn (
52
+ "Style includes a parameter, '{0}', that is not related "
53
+ "to style. Ignoring" .format (key ))
53
54
else :
54
55
o [key ] = val
55
56
return o
@@ -60,8 +61,8 @@ def is_style_file(filename):
60
61
return STYLE_FILE_PATTERN .match (filename ) is not None
61
62
62
63
63
- def _apply_style (d ):
64
- mpl .rcParams .update (_remove_blacklisted_style_params (d ))
64
+ def _apply_style (d , warn = True ):
65
+ mpl .rcParams .update (_remove_blacklisted_style_params (d , warn = warn ))
65
66
66
67
67
68
def use (style ):
@@ -98,7 +99,7 @@ def use(style):
98
99
if not cbook .is_string_like (style ):
99
100
_apply_style (style )
100
101
elif style == 'default' :
101
- _apply_style (rcParamsDefault )
102
+ _apply_style (rcParamsDefault , warn = False )
102
103
elif style in library :
103
104
_apply_style (library [style ])
104
105
else :
Original file line number Diff line number Diff line change 7
7
from matplotlib .testing .decorators import cleanup , switch_backend
8
8
from matplotlib .testing .decorators import knownfailureif
9
9
from matplotlib ._pylab_helpers import Gcf
10
- import matplotlib . style as mstyle
10
+ import matplotlib
11
11
import copy
12
12
13
13
try :
17
17
import mock
18
18
19
19
try :
20
- with mstyle . context ( {'backend' : 'Qt4Agg' }):
20
+ with matplotlib . rc_context ( rc = {'backend' : 'Qt4Agg' }):
21
21
from matplotlib .backends .qt_compat import QtCore
22
22
23
23
from matplotlib .backends .backend_qt4 import (MODIFIER_KEYS ,
Original file line number Diff line number Diff line change 6
6
from matplotlib .testing .decorators import cleanup , switch_backend
7
7
from matplotlib .testing .decorators import knownfailureif
8
8
from matplotlib ._pylab_helpers import Gcf
9
- import matplotlib . style as mstyle
9
+ import matplotlib
10
10
import copy
11
11
12
12
try :
16
16
import mock
17
17
18
18
try :
19
- with mstyle . context ( {'backend' : 'Qt5Agg' }):
19
+ with matplotlib . rc_context ( rc = {'backend' : 'Qt5Agg' }):
20
20
from matplotlib .backends .qt_compat import QtCore , __version__
21
21
from matplotlib .backends .backend_qt5 import (MODIFIER_KEYS ,
22
22
SUPER , ALT , CTRL , SHIFT )
You can’t perform that action at this time.
0 commit comments