nschloe / matplotx

:bar_chart: More styles and useful extensions for Matplotlib

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Some styles are broken

floringogianu opened this issue · comments

Using the code example in the readme:

import matplotlib.pyplot as plt
import matplotx
plt.style.use(matplotx.styles.ayu)

I get this error:

File ~/.conda/envs/.../lib/python3.10/site-packages/matplotlib/style/core.py:117, in use(style)
    115 for style in styles:
    116     if not isinstance(style, (str, Path)):
--> 117         _apply_style(style)
    118     elif style == 'default':
    119         # Deprecation warnings were already handled when creating
    120         # rcParamsDefault, no need to reemit them here.
    121         with _api.suppress_matplotlib_deprecation_warning():

File ~/.conda/envs/.../lib/python3.10/site-packages/matplotlib/style/core.py:62, in _apply_style(d, warn)
     61 def _apply_style(d, warn=True):
---> 62     mpl.rcParams.update(_remove_blacklisted_style_params(d, warn=warn))

File ~/.conda/envs/.../lib/python3.10/_collections_abc.py:994, in MutableMapping.update(self, other, **kwds)
    992 if isinstance(other, Mapping):
    993     for key in other:
--> 994         self[key] = other[key]
    995 elif hasattr(other, "keys"):
    996     for key in other.keys():

File ~/.conda/envs/.../lib/python3.10/site-packages/matplotlib/__init__.py:649, in RcParams.__setitem__(self, key, val)
    647     dict.__setitem__(self, key, cval)
    648 except KeyError as err:
--> 649     raise KeyError(
    650         f"{key} is not a valid rc parameter (see rcParams.keys() for "
    651         f"a list of valid parameters)") from err

KeyError: 'dark is not a valid rc parameter (see rcParams.keys() for a list of valid parameters)'

Lib versions:

matplotlib-base           3.5.2           py310h5701ce4_1    conda-forge
matplotx                  0.3.7                    pypi_0    pypi

This happens with aura, ayu, github, gruvbox and others.

Some of the themes working are: challenger_deep, dracula, dufte, nord, tab10

Sorry, I didn't notice the style variations are actually dictionaries in parent styles, eg:

plt.style.use(matplotx.styles.tokyo_night["day"])

Will close the issue.