@@ -72,7 +72,7 @@ def use(style):
7272
7373 Parameters
7474 ----------
75- style : str, dict, or list
75+ style : str, dict, Path or list
7676 A style specification. Valid options are:
7777
7878 +------+-------------------------------------------------------------+
@@ -82,22 +82,25 @@ def use(style):
8282 | dict | Dictionary with valid key/value pairs for |
8383 | | `matplotlib.rcParams`. |
8484 +------+-------------------------------------------------------------+
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. |
8786 +------+-------------------------------------------------------------+
87+ | list | A list of style specifiers (str, Path or dict) applied from |
88+ | | first to last in the list. |
89+ +------+-------------------------------------------------------------+
90+
8891 """
8992 style_alias = {'mpl20' : 'default' ,
9093 '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.
9396 styles = [style ]
9497 else :
9598 styles = style
9699
97100 styles = (style_alias .get (s , s ) if isinstance (s , str ) else s
98101 for s in styles )
99102 for style in styles :
100- if not isinstance (style , str ):
103+ if not isinstance (style , ( str , Path ) ):
101104 _apply_style (style )
102105 elif style == 'default' :
103106 # Deprecation warnings were already handled when creating
@@ -123,7 +126,7 @@ def context(style, after_reset=False):
123126
124127 Parameters
125128 ----------
126- style : str, dict, or list
129+ style : str, dict, Path or list
127130 A style specification. Valid options are:
128131
129132 +------+-------------------------------------------------------------+
@@ -133,8 +136,10 @@ def context(style, after_reset=False):
133136 | dict | Dictionary with valid key/value pairs for |
134137 | | `matplotlib.rcParams`. |
135138 +------+-------------------------------------------------------------+
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. |
138143 +------+-------------------------------------------------------------+
139144
140145 after_reset : bool
0 commit comments