Skip to main contentSkip to solution

Arrange the given steps of drawing chart using matplotib library in correct order.

A. plt.show()

B. import matplotlib.pyplot as plt

C. pip install matplotlib

D. date=["25/12","26/12","27/12"]

temp=[8.5,10.5,6.8]

E. plt.plot(date, temp)

Solution

✅ Correct Option: 4

C: pip install matplotlib. The library must be installed before it can be imported.

B: import matplotlib.pyplot as plt. The import makes the plotting functions available.

D: date and temp lists. This is the data to be plotted.

E: plt.plot(date, temp). This draws the line chart from the data.

A: plt.show(). This displays the chart, so it comes last.

Keyboard Shortcuts

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