Thursday, January 22, 2026
HomeLanguagesMatplotlib.axes.SubplotBase() in Python

Matplotlib.axes.SubplotBase() in Python

Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. The Axes Class contains most of the figure elements: Axis, Tick, Line2D, Text, Polygon, etc., and sets the coordinate system. And the instances of Axes supports callbacks through a callbacks attribute.

matplotlib.axes.SubplotBase() class

It is a base class for subplots which is Axes instances. It provide various new methods which are used to generate and manipulate a set of Axes within a figure object.
Note: In the SubplotBase, the Base is the object.

Syntax: class matplotlib.axes.SubplotBase(fig, *args, **kwargs)

Parameters: This accept the following parameters that are described below:

  • fig: This parameter is the matplotlib.figure.Figure.
  • *args: This parameter contains the tuple of values (nrows, ncols, index).In other words, it is the array of subplots in the figure has dimensions (nrows, ncols) and index is the index of the subplot being created.

Below examples illustrate the matplotlib.axes.SubplotBase() class in matplotlib.axes:
Example 1:




# Implementation of matplotlib function
import matplotlib.pyplot as plt
from mpl_toolkits.axisartist.axislines import SubplotZero
import numpy as np
  
fig = plt.figure(figsize =(4, 3))
  
# Zero is the base
ax = SubplotZero(fig, 1, 1, 1)
fig.add_subplot(ax)
  
xx = np.arange(0, 2 * np.pi, 0.01)
ax.plot(xx, np.sin(xx))
  
fig.suptitle('matplotlib.axes.SubplotBase() class Example\n\n'
             fontweight ="bold")
  
plt.show()


Output:

Example 2:




# Implementation of matplotlib function
import matplotlib.pyplot as plt
from mpl_toolkits.axisartist.axislines import Subplot
  
fig = plt.figure()
  
ax = Subplot(fig, 111)
fig.add_subplot(ax)
  
ax.axis["left"].set_visible(False)
ax.axis["top"].set_visible(False)
  
fig.suptitle('matplotlib.axes.SubplotBase() class Example\n\n',
              fontweight ="bold")
  
plt.show()


Output:

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32475 POSTS0 COMMENTS
Milvus
119 POSTS0 COMMENTS
Nango Kala
6847 POSTS0 COMMENTS
Nicole Veronica
11977 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12064 POSTS0 COMMENTS
Shaida Kate Naidoo
6986 POSTS0 COMMENTS
Ted Musemwa
7220 POSTS0 COMMENTS
Thapelo Manthata
6933 POSTS0 COMMENTS
Umr Jansen
6912 POSTS0 COMMENTS