- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What's the difference between Matplotlib.pyplot and Matplotlib.figure?
matplotlib.pyplot
The matplotlib.pyplot is a collection of functions that make matplotlib work like MATLAB. Each pyplot function makes some change to a figure: e.g., creates a figure, creates a plotting area in a figure, plots some lines in a plotting area, decorates the plot with labels, etc.
In matplotlib.pyplot, various states are preserved across function calls, so that it keeps track of things like the current figure and plotting area, and the plotting functions are directed to the current axes
matplotlib.figure
The figure keeps track of all the child Axes, a smattering of 'special' artists (titles, figure legends,etc), and the canvas. A figure can contain any number of Axes, but will typically have at least one.
Example
from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True fig = plt.figure("I am figure window") plt.show()
Output
- Related Articles
- How can I attach a pyplot function to a figure instance? (Matplotlib)
- What is the difference between importing matplotlib and matplotlib.pyplot?
- How is the Pyplot histogram bins interpreted? (Matplotlib)
- What is the difference between drawing plots using plot, axes or figure in matplotlib?
- What is the difference between plt.close() and plt.clf() in Matplotlib?
- How can I set the background color on specific areas of a Pyplot figure using Matplotlib?
- Matplotlib – Difference between plt.subplots() and plt.figure()
- How to zoom subplots together in Matplotlib/Pyplot?
- What is the difference between plt.show and cv2.imshow in Matplotlib?
- How do I close all the open pyplot windows (Matplotlib)?
- Change figure size and figure format in Matplotlib
- How to fill the area under a step curve using pyplot? (Matplotlib)
- How do you get the current figure number in Python's Matplotlib?
- What is the difference between 'log' and 'symlog' in matplotlib?
- What is the difference betweent set_xlim and set_xbound in Matplotlib?
- What are the differences between add_axes and add_subplot in Matplotlib?

Advertisements