栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

有一个类matplotlib.axes.AxesSubplot,但是模块matplotlib.axes没有属性AxesSubplot

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

有一个类matplotlib.axes.AxesSubplot,但是模块matplotlib.axes没有属性AxesSubplot

嘿。这是因为有

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


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/641599.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号