What is the purpose of the plt.bar() function in Matplotlib?
Correct answer
C. To create a bar plot
15 views
C. To create a bar plot
15 views
plt.bar() creates a bar plot with vertical bars, used for comparing categories: plt.bar(categories, values).
plt.barh() draws horizontal bars. A histogram (plt.hist()) is different — it shows the distribution of one numeric variable.
Practise more Data Science MCQs with answers and explanations on MCQsExam.com.
Not sure why the answer is C? Ask here and get an explanation.