嘿。这是因为有 是 无
AxesSubplot类..直到有需要,当一个人从建
Subplotbase。这是通过以下方法实现的
axes.py:
def subplot_class_factory(axes_class=None): # This makes a new class that inherits from Subplotbase and the # given axes_class (which is assumed to be a subclass of Axes). # This is perhaps a little bit roundabout to make a new class on # the fly like this, but it means that a new Subplot class does # not have to be created for every type of Axes. if axes_class is None: axes_class = Axes new_class = _subplot_classes.get(axes_class) if new_class is None: new_class = new.classobj("%sSubplot" % (axes_class.__name__),(Subplotbase, axes_class),{'_axes_class': axes_class}) _subplot_classes[axes_class] = new_class return new_class因此它是即时生成的,但是它是的子类
Subplotbase:
>>> import matplotlib.pyplot as plt>>> fig = plt.figure()>>> ax = fig.add_subplot(111)>>> print type(ax)<class 'matplotlib.axes.AxesSubplot'>>>> b = type(ax)>>> import matplotlib.axes>>> issubclass(b, matplotlib.axes.Subplotbase)True



