当前位置: 首页>>代码示例>>Python>>正文


Python Stack.remove方法代码示例

本文整理汇总了Python中cbook.Stack.remove方法的典型用法代码示例。如果您正苦于以下问题:Python Stack.remove方法的具体用法?Python Stack.remove怎么用?Python Stack.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cbook.Stack的用法示例。


在下文中一共展示了Stack.remove方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: add

# 需要导入模块: from cbook import Stack [as 别名]
# 或者: from cbook.Stack import remove [as 别名]
    def add(self, key, a):
        """
        Add Axes *a*, with key *key*, to the stack, and return the stack.

        If *a* is already on the stack, don't add it again, but
        return *None*.
        """
        # All the error checking may be unnecessary; but this method
        # is called so seldom that the overhead is negligible.
        if not isinstance(a, Axes):
            raise ValueError("second argument, %s, is not an Axes" % a)
        try:
            hash(key)
        except TypeError:
            raise ValueError("first argument, %s, is not a valid key" % key)

        a_existing = self.get(key)
        if a_existing is not None:
            Stack.remove(self, (key, a_existing))
            warnings.Warn(
                    "key %s already existed; Axes is being replaced" % key)
            # I don't think the above should ever happen.

        if a in self:
            return None
        self._ind += 1
        return Stack.push(self, (key, (self._ind, a)))
开发者ID:,项目名称:,代码行数:29,代码来源:

示例2: remove

# 需要导入模块: from cbook import Stack [as 别名]
# 或者: from cbook.Stack import remove [as 别名]
 def remove(self, a):
     Stack.remove(self, self._entry_from_axes(a))
开发者ID:,项目名称:,代码行数:4,代码来源:

示例3: Figure

# 需要导入模块: from cbook import Stack [as 别名]
# 或者: from cbook.Stack import remove [as 别名]

#.........这里部分代码省略.........
        ACCEPTS: a FigureCanvas instance
        """
        self.canvas = canvas

    def _get_unit_conversion(self, python_type):
        """
        Get a unit conversion corresponding to a python type
        """
        maps = [self._unit_conversions, Figure._default_unit_conversions]

        for m in maps:
            classes = [python_type]
            for current in classes:
                if (current in m):
                    # found it!
                    #print 'Found unit conversion for %s!' % (`python_type`)
                    return m[current]
        return None 

    def register_unit_conversion(self, python_type, conversion):
        """
        Register a unit conversion class

        ACCEPTS: a Unit instance
        """
        self._unit_conversions[python_type] = conversion

    def unregister_unit_conversion(self, python_type):
        """
        Unregister a unit conversion class

        ACCEPTS: any Python type
        """
        self._unit_conversions.remove(python_type)
    
    def _register_default_unit_conversion(python_type, conversion):
        """
        Register a unit conversion class

        ACCEPTS: a Unit instance
        """
        Figure._default_unit_conversions[python_type] = conversion

    _default_unit_conversions = {}
    register_default_unit_conversion = \
        staticmethod(_register_default_unit_conversion)
 
    def _unregister_default_unit_conversion(python_type):
        """
        Unregister a unit conversion class

        ACCEPTS: any Python type
        """
        Figure._default_unit_conversions.remove(python_type)

    unregister_default_unit_conversion = \
        staticmethod(_unregister_default_unit_conversion)

    def hold(self, b=None):
        """
        Set the hold state.  If hold is None (default), toggle the
        hold state.  Else set the hold state to boolean value b.

        Eg
        hold()      # toggle hold
        hold(True)  # hold is on
开发者ID:,项目名称:,代码行数:70,代码来源:

示例4: remove

# 需要导入模块: from cbook import Stack [as 别名]
# 或者: from cbook.Stack import remove [as 别名]
 def remove(self, a):
     """Remove the axes from the stack."""
     Stack.remove(self, self._entry_from_axes(a))
开发者ID:KennethNielsen,项目名称:matplotlib,代码行数:5,代码来源:figure.py

示例5: Figure

# 需要导入模块: from cbook import Stack [as 别名]
# 或者: from cbook.Stack import remove [as 别名]

#.........这里部分代码省略.........
    def set_dpi(self, val):
        """
        Set the dots-per-inch of the figure

        ACCEPTS: float
        """
        self.dpi.set(val)

    def set_figwidth(self, val):
        """
        Set the width of the figure in inches

        ACCEPTS: float
        """
        self.figwidth.set(val)

    def set_figheight(self, val):
        """
        Set the height of the figure in inches

        ACCEPTS: float
        """
        self.figheight.set(val)

    def set_frameon(self, b):
        """
        Set whether the figure frame (background) is displayed or invisible

        ACCEPTS: boolean
        """
        self.frameon = b

    def delaxes(self, a):
        'remove a from the figure and update the current axes'
        self.axes.remove(a)
        self._axstack.remove(a)
        keys = []
        for key, thisax in self._seen.items():
            if a==thisax: del self._seen[key]
        for func in self._axobservers: func(self)



    def _make_key(self, *args, **kwargs):
        'make a hashable key out of args and kwargs'

        def fixitems(items):
            #items may have arrays and lists in them, so convert them
            # to tuples for the key
            ret = []
            for k, v in items:
                if iterable(v): v = tuple(v)
                ret.append((k,v))
            return tuple(ret)

        def fixlist(args):
            ret = []
            for a in args:
                if iterable(a): a = tuple(a)
                ret.append(a)
            return tuple(ret)

        key = fixlist(args), fixitems(kwargs.items())
        return key

    def add_axes(self, *args, **kwargs):
开发者ID:gkliska,项目名称:razvoj,代码行数:70,代码来源:figure.py


注:本文中的cbook.Stack.remove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。