@@ -72,7 +72,7 @@ def use(style):
72
72
73
73
Parameters
74
74
----------
75
- style : str, dict, or list
75
+ style : str, dict, Path or list
76
76
A style specification. Valid options are:
77
77
78
78
+------+-------------------------------------------------------------+
@@ -82,22 +82,25 @@ def use(style):
82
82
| dict | Dictionary with valid key/value pairs for |
83
83
| | `matplotlib.rcParams`. |
84
84
+------+-------------------------------------------------------------+
85
- | list | A list of style specifiers (str or dict) applied from first |
86
- | | to last in the list. |
85
+ | Path | A path-like object which is a path to a style file. |
87
86
+------+-------------------------------------------------------------+
87
+ | list | A list of style specifiers (str, Path or dict) applied from |
88
+ | | first to last in the list. |
89
+ +------+-------------------------------------------------------------+
90
+
88
91
"""
89
92
style_alias = {'mpl20' : 'default' ,
90
93
'mpl15' : 'classic' }
91
- if isinstance (style , str ) or hasattr (style , 'keys' ):
92
- # If name is a single str or dict, make it a single element list.
94
+ if isinstance (style , ( str , Path ) ) or hasattr (style , 'keys' ):
95
+ # If name is a single str, Path or dict, make it a single element list.
93
96
styles = [style ]
94
97
else :
95
98
styles = style
96
99
97
100
styles = (style_alias .get (s , s ) if isinstance (s , str ) else s
98
101
for s in styles )
99
102
for style in styles :
100
- if not isinstance (style , str ):
103
+ if not isinstance (style , ( str , Path ) ):
101
104
_apply_style (style )
102
105
elif style == 'default' :
103
106
# Deprecation warnings were already handled when creating
@@ -123,7 +126,7 @@ def context(style, after_reset=False):
123
126
124
127
Parameters
125
128
----------
126
- style : str, dict, or list
129
+ style : str, dict, Path or list
127
130
A style specification. Valid options are:
128
131
129
132
+------+-------------------------------------------------------------+
@@ -133,8 +136,10 @@ def context(style, after_reset=False):
133
136
| dict | Dictionary with valid key/value pairs for |
134
137
| | `matplotlib.rcParams`. |
135
138
+------+-------------------------------------------------------------+
136
- | list | A list of style specifiers (str or dict) applied from first |
137
- | | to last in the list. |
139
+ | Path | A path-like object which is a path to a style file. |
140
+ +------+-------------------------------------------------------------+
141
+ | list | A list of style specifiers (str, Path or dict) applied from |
142
+ | | first to last in the list. |
138
143
+------+-------------------------------------------------------------+
139
144
140
145
after_reset : bool
0 commit comments