Matplotlib.pyplot.hlines() in Python Last Updated : 19 Apr, 2020 Comments Improve Suggest changes Like Article Like Report Matplotlib is an amazing visualization library in Python for 2D plots of arrays. Matplotlib is a multi-platform data visualization library built on NumPy arrays and designed to work with the broader SciPy stack. Matplotlib.pyplot.hlines() The Matplotlib.pyplot.hlines() is used to draw horizontal lines in a graph at each y from xmin to xmax. Syntax: matplotlib.pyplot.hlines(y, xmin, xmax, colors='k', linestyles='solid', label='', *, data=None, **kwargs Parameters: The Matplotlib.pyplot.hlines() accepts the below-described parameters: y : It is a required parameter for this method. This parameter describes that in the graph the line is to be drawn. Its value is a scalar or sequence of scalars, in other words, it is the y-indexes where the line is to be plotted. xmin: It is a required parameter that has either a scalar value or a 1D array-like value that sets the beginning of each line. If scalars are provided all the lines will have the same length. colors: As the name suggests it is used to set the color of the line to be plotted. This parameter is optional in nature and its default value is 'k' linestyles: It is also an optional parameter that accepts four values namely 'solid', 'dashed', 'dashdot' and 'dotted'. It is responsible for setting the style of the line to be plotted. label: It is an optional parameter used to describe information about the plotted line in the same line. This accepts a string whose default value is an empty string. **kwargs: This parameter is used to make use of LineCollection properties in the plotted line. Note: In addition to the above-mentioned parameters, this method can take a data keyword argument. It is also important to note that the object passed as data must support item access and membership test. Example 1: Python3 1== from matplotlib import pyplot as plt plt.hlines(y = 1, xmin = 1, xmax = 4) plt.hlines(y = 1.6, xmin = 1.5, xmax = 4.5) plt.hlines(y = 2, xmin = 2, xmax = 5) Output : Example 2: Python3 1== from matplotlib import pyplot as plt plt.hlines(y = 1, xmin = 1, xmax = 4, label ="black line") plt.hlines(y = 1.6, xmin = 1.5, xmax = 4.5, color ='r') plt.text(1, 1.6, 'Red line', ha ='left', va ='center') plt.hlines(y = 2, xmin = 2, xmax = 5) Output : Comment More infoAdvertise with us Next Article Matplotlib.pyplot.hlines() in Python R RajuKumar19 Follow Improve Article Tags : Python Write From Home Python-Library Python-matplotlib Practice Tags : python Similar Reads matplotlib.pyplot.axhline() in Python Matplotlib is a library in Python and it is numerical - mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface. matplotlib.pyplot.axhline() Function The axhline() function in pyplot module of matplotlib library is use 2 min read Matplotlib.pyplot.axvline() in Python Matplotlib is a plotting library for creating static, animated, and interactive visualizations in Python. Matplotlib can be used in Python scripts, the Python and IPython shell, web application servers, and various graphical user interface toolkits like Tkinter, awxPython, etc. Note: For more inform 3 min read Matplotlib.pyplot.hsv() in Python Matplotlib is a library in Python and it is numerical - mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface. matplotlib.pyplot.hsv() Function The hsv() function in pyplot module of matplotlib library is used to set 2 min read Matplotlib.pyplot.ion() in Python Matplotlib is an amazing visualization library in Python for 2D plots of arrays. Matplotlib is a multi-platform data visualization library built on NumPy arrays and designed to work with the broader SciPy stack. The matplotlib.pyplot.ion() is used to turn on interactive mode. To check the status of 4 min read Matplotlib.pyplot.axes() in Python axes() method in Matplotlib is used to create a new Axes instance (i.e., a plot area) within a figure. This allows you to specify the location and size of the plot within the figure, providing more control over subplot layout compared to plt.subplot(). It's key features include:Creates a new Axes at 3 min read Matplotlib.pyplot.axis() in Python axis() function in Matplotlib is used to get or set properties of the x- and y-axis in a plot. It provides control over axis limits, aspect ratio and visibility, allowing customization of the plotâs coordinate system and view. It's key feature includes:Gets or sets the axis limits [xmin, xmax, ymin, 3 min read Matplotlib.pyplot.bone() in Python Matplotlib is a library in Python and it is numerical - mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface. There are various plots which can be used in Pyplot are Line Plot, Contour, Histogram, Scatter, 3D Plot, 2 min read Matplotlib.pyplot.clim() in Python Matplotlib is a library in Python and it is numerical - mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface. There are various plots which can be used in Pyplot are Line Plot, Contour, Histogram, Scatter, 3D Plot, 2 min read Matplotlib.pyplot.hist2d() in Python Matplotlib is a library in Python and it is numerical - mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface. matplotlib.pyplot.hist2d() Function The hist2d() function in pyplot module of matplotlib library is used 2 min read Matplotlib.pyplot.csd() in Python csd() method in Matplotlib is used to compute and plot the Cross Spectral Density (CSD) of two signals. It helps analyze the frequency domain relationship between two time series, revealing how the power of one signal is distributed relative to the other signal across frequencies. It's key features 4 min read Like