Why barh() function is used in plotting?

28. Why barh() function is used in plotting?

  1. To draw a bar graph with a specified height
  2. To draw a bar graph to print the highest values of a NumPy array
  3. To draw a horizontal bar graph
  4. None of the above

Answer: C) To draw a horizontal bar graph

Explanation:

The barh() function is used to draw a horizontal bar graph. The barh() function takes the same arguments as the "bar()" function. Consider the below code statement to draw a horizontal bar graph –

name = ["Alvin", "Alex"]
age = [21, 23]
plt.barh(name, age)

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.