Articles â†’ Matplotlib â†’ Figure Object And Subplots Function In Matplotlib

Figure Object And Subplots Function In Matplotlib






Figure Object


  1. Figure is outmost container of matplotlib graphics.
  2. Figure contains multiple axes.
  3. 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()




Picture showing the output of the figure object and subplots function in matplotlib



Posted By  -  Karan Gupta
 
Posted On  -  Tuesday, June 11, 2019

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250