Matplotlib is a library in Python used to create figures and provide tools for customizing it. It allows plotting different types of data, geometrical figures. In this article, we will see how to add axes to a figure in matplotlib.
We can add axes to a figure in matplotlib by passing a list argument in the add_axes() method.
rect: This parameter is the dimensions [xmin, ymin, dx, dy] of the new axes. It takes the below elements as arguments in the list:
- xmin: Horizontal coordinate of the lower left corner.
- ymin: Vertical coordinate of the lower left corner.
- dx: Width of the subplot.
- dy: Height of the subplot.
Returns: This method return the axes class depends on the projection used.
Below are some programs which depict how to add axes to a figure in matplotlib:
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