Home »
Python »
Matplotlib MCQs
Which is used for plotting a horizontal line?
34. Which is used for plotting a horizontal line?
- hline()
- ahline()
- xhline()
- axhline()
Answer: D) axhline()
Explanation:
For plotting a horizontal line, you can simply use the axhline() function.
Syntax:
matplotlib.pyplot.axhline(y, color, xmin, xmax, linestyle)