What is the difference between importing matplotlib and matplotlib.pyplot?

I don’t know of any way to import all the functions from every submodule. Importing all the functions from a submodule is possible the way you suggested with e.g. from matplotlib.pyplot import *.

Be noted of a potential problem with importing every function; you may override imported functions by defining your own functions with the same name. E.g:

from matplotlib.pyplot import *

def plot():
    print "Hello!"

plot()

would output

Hello!

Leave a Comment