Pythonista-Issues
Pythonista-Issues copied to clipboard
Matplotlib.pyplot is unrecognized
Throws an error when I try to run a plotting routine. I would like to know if there is a fix for this. It works fine under a normal interpreter.
import matplotlib.pyplot as plt
Works fine for me. Note importing matplotlib the first time takes a long time -- if you hit X during the import, things are left in a strange state. Force quit pythonista and try again
Is there any reason for the weird state of matplotlib? I was under the impression it was a new console every time you hit run similar to spyder?
Built-in modules do not get cleared when hitting run. Only globals and non-site-packages user modules. The interpreter does not actually get reinitialized. You could also del all modules from sys.modules that start with matplotlib -- but it is easiest just to force quit pythonista.
Once matplotlib imports the first time, you don't need to worry about hitting X, because it is already loaded.