CBSE Class 12 Informatics Practices Question 28 of 73

Data Visualization using Matplotlib — Question 5

Back to all questions
5
Question

Question 5

Which of the following commands is used to install Matplotlib for coding?

  1. import plt.matplotlib as plot
  2. import plot.matplotlib as pt
  3. import matplotlib.plt as plot
  4. import matplotlib.pyplot as plt
Answer

import matplotlib.pyplot as plt

Reason — The correct command to import Matplotlib for coding is import matplotlib.pyplot as plt. This is the standard way to import Matplotlib, where matplotlib.pyplot is the module that provides the plotting functions, and as plt assigns the alias plt to the pyplot module.