![]() ![]() The axhline() function has similar parameters as in hlines() function. The axhline() function is designed to draw horizontal lines to the plot. As an argument, we have passed the values and got the result as shown above. We used the matplotlib.pyplot library to create a horizontal line with the help of the hlines() function. The lineColor will add the required colors to the line, and the lineStyle will add the style or type of the line we specified. XaxisStart and XaxisEnd indicate where the line starts and where it will end. Here, four parameters are used, Yaxis will denote the position on the y-axis when we need to plot a line. Hlines(Yaxis, XaxisStart, XaxisEnd, lineColor, lineStyle) When we want to draw a horizontal line across the axes, we use the hlines() function. We apply the ot() function to draw a line, and for visual purposes, we have used plotLine.show(). ![]() In this example, we stated the y-axis points to be 0 because our goal is to draw a horizontal line. X points are x-axis points towards the plot, and Y points are y-axis points.įirst, we imported the matplotlib.pyplot library, then outlined the data points we wanted to plot. When our goal is to produce 2D plots, we can use the Plot() function.
0 Comments
Leave a Reply. |