本文整理汇总了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)))
示例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))
示例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
示例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))
示例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):