Consider the following import command : import matplotlib.pyplot as PLT Which…

2023

Consider the following import command : import matplotlib.pyplot as PLT Which of the following command will help us to draw a line chart for given values?

  1. A.

    PLT.lineplot([100, 400, 200, 300])

  2. B.

    PLT.plotline([100, 400, 200, 300])

  3. C.

    PLT.line([100, 400, 200, 300])

  4. D.

    PLT.plot([100, 400, 200, 300])

Attempted by 1234 students.

Show answer & explanation

Correct answer: D

To draw a line chart in matplotlib, we use the plot() function of matplotlib.pyplot. Other options like lineplot, plotline, or line are not valid functions in matplotlib. So, the correct command is: PLT.plot([100, 400, 200, 300])

Explore the full course: Bpsc