Plotting using Object Oriented(OO) API in matplotlib is an easy approach to plot graphs and other data visualization methods.
The simple syntax to create the class and object for sub-plotting is –
class_name, object_name = matplotlib.pyplot.subplots(‘no_of_rows’, ‘no_of_columns’)
Let’s take some examples to make it more clear.
In the above example, we used ‘axes'(the object of the class ‘fig’) as an array at the time of plotting graph, it is because when we define the number of rows and columns then array of the objects is created with ‘n’ number of elements where ‘n’ is the product of rows and columns, so if we have 2 columns and two rows then there will be array of 4 elements.
- Different plotting using pandas and matplotlib
- Object Oriented Programming in Python | Set 2 (Data Hiding and Object Printing)
- Object Oriented Programming in Python | Set 1 (Class, Object and Members)
- Python | Introduction to Matplotlib
- Python | Working with PNG Images using Matplotlib
- Python | Matplotlib.pyplot ticks
- Python | Basic Gantt chart using Matplotlib
- Python | Visualize graphs generated in NetworkX using Matplotlib
- Graph Plotting in Python | Set 2
- Graph Plotting in Python | Set 1
- Graph Plotting in Python | Set 3
- Plotting graph using Seaborn | Python
- Python | Geographical plotting using plotly
- Python | Plotting Google Map using folium package
- SunPy | Plotting a Solar Image in Python
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : nidhi_biet