Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

plt.style.use('./deeplearning.mplstyle') is not working

Tags:

matplotlib

I am trying to run the optional labs of the machine learning specialization from coursera, and I stuck with some libraries and functions that I can not install

plt.style.use('./deeplearning.mplstyle')

I got the error message

ModuleNotFoundError Traceback (most recent call last)
in

          3 import matplotlib.pyplot as plt
          4 print(plt.style.available)
    ----> 5 plt.style.use('./deeplearning.mplstyle')

OSError: './deeplearning.mplstyle' not found in the style library and input is not a valid URL or path; see `style.available` for list of available styles

What can I do?

like image 489
Sudipta Progga Islam Avatar asked Oct 18 '25 03:10

Sudipta Progga Islam


2 Answers

You need to download the deeplearning.mplstyle file to use the plotting style.

To download this file from the Optional Lab follow these steps

  1. Open the Optional Lab from your course.
  2. Click on File -> Open
  3. Select deeplearning.mplstyle and select download option on top
  4. Save this file to your working directory. To use plt.style.use('./deeplearning.mplstyle') as is - make sure your main code file and deeplearning.mplstyle are in the same folder.
like image 131
Radhika Bhagat Avatar answered Oct 30 '25 07:10

Radhika Bhagat


It is because you may did not download all the files from coursera. Make sure to download all the files, especially, deeplearning.mplstyle, lab_utils_common.py, lab_utils_multi.py and keep them in one folder.

like image 36
Saif Ur Rehman Avatar answered Oct 30 '25 06:10

Saif Ur Rehman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!