In object-oriented API, first, we create a canvas on which we have to plot the graph and then we plot the graph. Many people prefer object-oriented API because it is easy to use as compared to functional API.
Let’s try to understand this with some examples.
Everything is pretty much clear in the first example but there is a thing that needs to be focused on, “Setting size of the canvas”, what this basically means is to set the size of the figure on which you want to plot the graph, the syntax is like this.
add_axes([left, bottom, width, height])
The values of left, bottom, height and width lies between 0 to 1. Another example will make you more clear about this concept.
- Python | Matplotlib Sub plotting using object oriented API
- Different plotting using pandas and matplotlib
- Graph Plotting in Python | Set 1
- Graph Plotting in Python | Set 3
- Graph Plotting in Python | Set 2
- Object Oriented Programming in Python | Set 2 (Data Hiding and Object Printing)
- Plotting graph using Seaborn | Python
- 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
- Python | Geographical plotting using plotly
- 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 firstname.lastname@example.org. 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.