Matplotlib.pyplot.broken_barh() in Python
Matplotlib is one of the most popular Python packages used for data visualization. It is a cross-platform library for making 2D plots from data in arrays. Pyplot is a collection of command style functions that make matplotlib work like MATLAB.
The function broken_barh() is used to Plot a horizontal sequence of rectangles.A rectangle is drawn for each component of xranges which consists of a sequence of tuples. All rectangles have the same vertical position and estimate characterized by yrange.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course
Syntax: matplotlib.pyplot.broken_barh(xranges, yrange, *, data=None, **kwargs)
- xranges : sequence of tuples (xmin, xwidth)
Each tuples gives the position(xmin) of the rectangle and it’s horizontal extension(xwidth) from that position.
- yranges : (ymin, ymax)
In the above attribute, ymin gives the position of the rectangle and ymax gives the vertical extension from ymin.
- BrokenBarHCollection: A collection of horizontal bars spanning yrange with a sequence of xranges.
Examples to illustrate the matplotlib.pyplot.broken_barh() function are as follows: