INNER CODE UNIT · Python
apply
lgienapp/aquarel · aquarel/theme.py:298
def apply(self):
"""
Applies the theme
"""
# Clear current state
mpl.rcParams.update(mpl.rcParamsDefault)
# Apply desired state
for top_key in self.params.keys():
for key, value in self.params[top_key].items():
mapped_key = self._rcparams_mapping[top_key][key]
if type(mapped_key) == list:
for sub_key in mapped_key:
# Special treatment for color palette, as this is otherwise not JSON serializable
if mapped_key == "axes.prop_cycle":
value = cycler("color", value)
if sub_key == "xaxis.labellocation":
if value not in ["left", "right", "center"]:
value = mpl.rcParamsDefault[sub_key]