@@ -34,6 +34,7 @@ def get_ipython():
34
34
__all__ = [
35
35
'rc' , 'rc_configurator' ,
36
36
'register_cmaps' , 'register_cycles' , 'register_colors' , 'register_fonts' ,
37
+ 'config_inline_backend' , 'use_style' ,
37
38
'inline_backend_fmt' , # deprecated
38
39
]
39
40
@@ -465,6 +466,11 @@ def _get_param_dicts(self, key, value):
465
466
if key == 'inlinefmt' :
466
467
config_inline_backend (value )
467
468
469
+ # Special key: apply stylesheet
470
+ elif key == 'style' :
471
+ if value is not None :
472
+ kw_params , kw_added = _get_style_dicts (value , infer = True )
473
+
468
474
# Cycler
469
475
elif key in ('cycle' , 'rgbcycle' ):
470
476
colors = _update_color_cycle (key , value )
@@ -1163,6 +1169,29 @@ def _infer_added_params(kw_params):
1163
1169
return kw_added
1164
1170
1165
1171
1172
+ def use_style (style ):
1173
+ """
1174
+ Apply the `matplotlib style(s) \
1175
+ <https://matplotlib.org/tutorials/introductory/customizing.html>`__
1176
+ with `matplotlib.style.use`. This function is
1177
+ called when you modify the :rcraw:`style` property.
1178
+
1179
+ Parameters
1180
+ ----------
1181
+ style : str, dict, or list thereof
1182
+ The matplotlib style name(s) or stylesheet filename(s), or dictionary(s)
1183
+ of settings. Use ``'default'`` to apply matplotlib default settings and
1184
+ ``'original'`` to include settings from your user ``matplotlibrc`` file.
1185
+ """
1186
+ # NOTE: This function is not really necessary but makes proplot's
1187
+ # stylesheet-supporting features obvious. Plus changing the style does
1188
+ # so much *more* than changing rc params or quick settings, so it is
1189
+ # nice to have dedicated function instead of just another rc_param name.
1190
+ kw_params , kw_added = _get_style_dicts (style , infer = True )
1191
+ rc_params .update (kw_params )
1192
+ rc_added .update (kw_added )
1193
+
1194
+
1166
1195
@docstring .add_snippets
1167
1196
def register_cmaps (user = True , default = False ):
1168
1197
"""
0 commit comments