A.2.1.1 Error when importing matplotlib

Issue: Error occurs when running this command to import matplotlib in a notebook:
%python

import matplotlib.pyplot as plt
plt.style.use('seaborn')
plt.figure(figsize=[10,5]) 

oml.graphics.boxplot(IRIS[:, :4], notch=True,
                     showmeans = True,
                     labels=IRIS.columns[:4])
                     
plt.title('Distribution of IRIS Attributes')

plt.ylabel('cm')
Error message:
Fail to execute line 2: plt.style.use('seaborn')

Traceback (most recent call last):

  File "/usr/local/lib/python3.12/site-packages/matplotlib/style/core.py", line 137, in use

    style = _rc_params_in_file(style)

            ^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.12/site-packages/matplotlib/__init__.py", line 866, in _rc_params_in_file

    with _open_file_or_url(fname) as fd:

  File "/usr/local/lib/python3.12/contextlib.py", line 137, in __enter__

    return next(self.gen)

           ^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.12/site-packages/matplotlib/__init__.py", line 843, in _open_file_or_url

    with open(fname, encoding='utf-8') as f:

         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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

....

OSError: 'seaborn' 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`)
Resolution: This error occurred due to a change that was introduced in Matplotlib 3.7.0. It affects all Python 3.12.x versions. Specifically, using plt.style.use('seaborn') was deprecated in Matplotlib 3.6 and removed in 3.7. You will encounter this error if you're using Python 3.12.x (any point version).

Note:

Ensure that you import Matplotlib ≥ 3.7.0.