Plot (matplotlib?) Problem
-
Hi!
Whenever I try to plot something I get the following error:Would be amazing if anyone here has a solution to that problem.
Thanks.
-
Hello Alain, I recommend uninstalling the Matplotlib module and try reinstalling it from the source itself as it default has the backend active. TkAgg usually has this error when it isnt active when you install the module on your system. If all else fails try installing with anaconda.
-
Hey @Robin-Dhillon Thanks for your answer. I had everything running with anaconda, but the plots didn't look as nice as they should (i pointed it out in an earlier post here). So I deinstalled everything conda related and switched to pycharm. Now I have the problem mentioned above.
So I now installed matplotlib as described on their site: python -m pip install -U matplotlib
Is this what you mean by "reinstalling it from the source itself" ? Or should I do what is written in the "Installing from source section" ? on this site https://matplotlib.org/users/installing.html . can it be that complicated ? :O
Thanks
-
@robin-dhillon Alright, so I added the following lines:
import matplotlib
matplotlib.use('PS')
then it worked. (when i directly save the plots they still don't look nice.. but that's not so important)
-
Just if you are curious, check out this documentation, outlines how to assign the backend needed without having to hardcode it every time in your imports. https://matplotlib.org/users/customizing.html#the-matplotlibrc-file
-
thanks @Robin-Dhillon, gonna check it out.