Home »
Python »
Matplotlib MCQs
Which function is used to draw bar graphs?
27. Which function is used to draw bar graphs?
- bar()
- bars()
- barchat()
- barplot()
Answer: A) bar()
Explanation:
To draw a bar graph, you can use the bar() function. Consider the below code statement to draw a bar graph –
name = ["Alvin", "Alex"]
age = [21, 23]
plt.bar(name, age)