Do not use
import matplotlib as plt
but rather use
import matplotlib.pyplot as plt
plt
is an abbreviation for pyplot
, which is a module inside the matplotlib
package. You need to address it for the kinds of things you are doing, not just matplotlib
.
Note that matplotlib
can be used without using pyplot
at all, but most people find it easier to use pyplot
. See its documentation or the tutorial for details.