'seaborn-whitegrid' is not a valid package style, path of style file

56 Views Asked by At

I'm trying to use a levelshift detector from adtk package and been following an example given in their documentation. The problem is I'm always getting the following error.

This is my code

import seaborn as sns
from adtk.detector import LevelShiftAD
from adtk.visualization import plot

level_shift_ad=LevelShiftAD(c=6.0, side='both', window=12)
anomalies=level_shift_ad.fit_detect(dft2)
plot(s, anomaly=anomalies, anomaly_color='red')

The error:

FileNotFoundError                         Traceback (most recent call last)
File c:\Users\ricac\AppData\Local\Programs\Python\Python312\Lib\site-packages\matplotlib\style\core.py:137, in use(style)
    136 try:
--> 137     style = _rc_params_in_file(style)
    138 except OSError as err:

File c:\Users\ricac\AppData\Local\Programs\Python\Python312\Lib\site-packages\matplotlib\__init__.py:879, in _rc_params_in_file(fname, transform, fail_on_error)
    878 rc_temp = {}
--> 879 with _open_file_or_url(fname) as fd:
    880     try:

File c:\Users\ricac\AppData\Local\Programs\Python\Python312\Lib\contextlib.py:137, in _GeneratorContextManager.__enter__(self)
    136 try:
--> 137     return next(self.gen)
    138 except StopIteration:

File c:\Users\ricac\AppData\Local\Programs\Python\Python312\Lib\site-packages\matplotlib\__init__.py:856, in _open_file_or_url(fname)
    855 fname = os.path.expanduser(fname)
--> 856 with open(fname, encoding='utf-8') as f:
    857     yield f

FileNotFoundError: [Errno 2] No such file or directory: 'seaborn-whitegrid'

The above exception was the direct cause of the following exception:
...
    142             f"styles are listed in `style.available`)") from err
    143 filtered = {}
    144 for k in style:  # don't trigger RcParams.__getitem__('backend')

OSError: 'seaborn-whitegrid' is not a valid package style, path of style file, URL of style file, or library style name (library styles are listed in `style.available`)

It says that the style whitegrid is not available, but when I check for the styles available I get:

plt.style.available
['Solarize_Light2',
 '_classic_test_patch',
 '_mpl-gallery',
 '_mpl-gallery-nogrid',
 'bmh',
 'classic',
 'dark_background',
 'fast',
 'fivethirtyeight',
 'ggplot',
 'grayscale',
 'seaborn-v0_8',
 'seaborn-v0_8-bright',
 'seaborn-v0_8-colorblind',
 'seaborn-v0_8-dark',
 'seaborn-v0_8-dark-palette',
 'seaborn-v0_8-darkgrid',
 'seaborn-v0_8-deep',
 'seaborn-v0_8-muted',
 'seaborn-v0_8-notebook',
 'seaborn-v0_8-paper',
 'seaborn-v0_8-pastel',
 'seaborn-v0_8-poster',
 'seaborn-v0_8-talk',
 'seaborn-v0_8-ticks',
 'seaborn-v0_8-white',
 'seaborn-v0_8-whitegrid',
 'tableau-colorblind10']

If I choose the 'seaborn-v0_8-whitegrid' I get an error message saying I must choose between white, dark, whitegrid, darkgrid, ticks

I tried to run this code and was expecting to get a plot with the changepoints marked

0

There are 0 best solutions below