Import matplotlib.pyplot as plt error

Asked

Viewed 489 times

-2

The import numpy as np gives well but this one gives this error and do not know how to solve it(open link): - http://prntscr.com/o2txe8

1 answer

1

Before importing the matplotlib try to spin this:

import matplotlib
matplotlib.use('Agg')

import matplotlib.pyplot as plt

According to that question and the documentation, backends are responsible for rendering the graphics, but some do not allow interaction with the user interface. When you arrow the backend to Agg, you will only be able to save the image and not view it with the plt.plot if I’m not mistaken.

Here has a list of available backends for you to take a look and test if interested. (:

Browser other questions tagged

You are not signed in. Login or sign up in order to post.