Articles → Matplotlib → Figure Object And Subplots Function In Matplotlib
Figure Object And Subplots Function In Matplotlib
Figure Object
- Figure is outmost container of matplotlib graphics.
- Figure contains multiple axes.
- Figure object is useful if you want to perform figure-level changes.
import matplotlib.pyplot as plt
fig = plt.figure()
Subplots Function
import matplotlib.pyplot as plt
fig = plt.figure()
X = plt.subplots(nrows = 2, ncols= 2) # a figure with a 2x2 grid of Axes
x = 0
while x < len(X):
print(X[x])
x = x + 1
plt.show()