Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Why isn't subplots in matplotlib working?

I have a python-script that is meant to test the functionality of matplotlib (among others). The script is working in terminal and Python console, but not in saved files executed from PyCharm (Linux) or Visual Studio Code (Windows). I do get the same error message for both environments about subplots missing, se screen dump:
enter image description here

The matplotlib code is copied from matplotlibs website for example code. What am I missing?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

There is a small difference between your code and the example code:

import matplotlib.pyplot as plt # import in the example
import matplotlib as plt # your code

Just need to fix your import.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading