Pythonista-Issues icon indicating copy to clipboard operation
Pythonista-Issues copied to clipboard

Matplotlib.pyplot is unrecognized

Open jalexcole opened this issue 7 years ago • 3 comments
trafficstars

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.

jalexcole avatar Nov 02 '18 19:11 jalexcole

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

jsbain avatar Nov 02 '18 20:11 jsbain

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?

jalexcole avatar Nov 05 '18 04:11 jalexcole

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.

jsbain avatar Nov 05 '18 05:11 jsbain