Skip to main contentSkip to solution

What does 'plt' signify in the following statement?

import matplotlib.pyplot as plt

Solution

✅ Correct Option: 1

The keyword as in an import statement gives the module a shorter nickname, called an alias. Here, plt is the alias for matplotlib.pyplot, so you can write plt.plot() instead of matplotlib.pyplot.plot().


Option 2: plt is only a nickname, not a library. Matplotlib itself is also a third-party library that must be installed separately, so it is not inbuilt.

Options 3 and 4: plt is a name used inside the code and has nothing to do with the script's file name or the image file. An image is saved only with a call like plt.savefig("name.png").

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question