Matplotlib is a popular python library used for plotting, It offers an object-oriented API come render GUI plotsPlotting a horizontal line is reasonably simple, using axhline()
Attention geek! strengthen your structures with the Python Programming Foundation Course and learn the basics. To begin with, her interview preparations enhance your Data Structures ideas with the Python DS Course. And also to start with your an equipment Learning Journey, join the Machine finding out - an easy Level Course
The axhline() function in pyplot module the matplotlib library is supplied to add a horizontal line across the axis.

You are watching: How to plot horizontal line in matlab

Syntax: matplotlib.pyplot.axhline(y, color, xmin, xmax, linestyle)Parameters:y: place on Y axis come plot the line, the accepts integers.xmin and xmax: scalar, optional, default: 0/1. It plots the line in the provided rangecolor: shade for the line, that accepts a string. Eg ‘r’ or ‘b’ .linestyle: Specifies the kind of line, that accepts a string. Zb ‘-‘, ‘–‘, ‘-.’, ‘:’, ‘None’, ‘ ‘, ”, ‘solid’, ‘dashed’, ‘dashdot’, ‘dotted’

Plotting a solitary horizontal line


Plotting lot of horizontal lines

To plot many horizontal lines, use the axhline() method multiple times.

See more: Watch Jersey Shore Family Vacation Online Putlockers, Jersey Shore: Family Vacation Season 4 Episode 10


Adding the legend

The legend have the right to be added using the legend() function.
Competitive Programming Live Classes for Students
DSA self Paced Course
How to download PIP on windows ?Python math function | sqrt()Python regimen to examine if a cable is palindrome or notPython - means to remove duplicates native listPython routine to inspect whether a number is prime or not
Python string length | len()Stack in PythonCheck if element exists in perform in PythonDefaultdict in PythonPython | Get distinctive values from a list
We usage cookies to ensure you have the ideal browsing suffer on ours website. By making use of our site, youacknowledge the you have actually read and also understood ourCookie policy & Privacy PolicyGot that !