本文整理汇总了Python中matplotlib.cbook.warn_deprecated方法的典型用法代码示例。如果您正苦于以下问题:Python cbook.warn_deprecated方法的具体用法?Python cbook.warn_deprecated怎么用?Python cbook.warn_deprecated使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.cbook
的用法示例。
在下文中一共展示了cbook.warn_deprecated方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_subplot_params
# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import warn_deprecated [as 别名]
def get_subplot_params(self, figure=None, fig=None):
"""
Return a dictionary of subplot layout parameters. The default
parameters are from rcParams unless a figure attribute is set.
"""
if fig is not None:
cbook.warn_deprecated("2.2", "fig", obj_type="keyword argument",
alternative="figure")
if figure is None:
figure = fig
if figure is None:
kw = {k: rcParams["figure.subplot."+k] for k in self._AllowedKeys}
subplotpars = mpl.figure.SubplotParams(**kw)
else:
subplotpars = copy.copy(figure.subplotpars)
subplotpars.update(**{k: getattr(self, k) for k in self._AllowedKeys})
return subplotpars
示例2: get
# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import warn_deprecated [as 别名]
def get(self, key):
"""
Return the Axes instance that was added with *key*.
If it is not present, return *None*.
"""
item = dict(self._elements).get(key)
if item is None:
return None
cbook.warn_deprecated(
"2.1",
"Adding an axes using the same arguments as a previous axes "
"currently reuses the earlier instance. In a future version, "
"a new instance will always be created and returned. Meanwhile, "
"this warning can be suppressed, and the future behavior ensured, "
"by passing a unique label to each axes instance.")
return item[1]
示例3: get
# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import warn_deprecated [as 别名]
def get(self, key):
"""
Return the Axes instance that was added with *key*.
If it is not present, return *None*.
"""
item = dict(self._elements).get(key)
if item is None:
return None
cbook.warn_deprecated(
"2.1",
message="Adding an axes using the same arguments as a previous "
"axes currently reuses the earlier instance. In a future "
"version, a new instance will always be created and returned. "
"Meanwhile, this warning can be suppressed, and the future "
"behavior ensured, by passing a unique label to each axes "
"instance.")
return item[1]
示例4: resize
# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import warn_deprecated [as 别名]
def resize(self, width, height=None):
# before 09-12-22, the resize method takes a single *event*
# parameter. On the other hand, the resize method of other
# FigureManager class takes *width* and *height* parameter,
# which is used to change the size of the window. For the
# Figure.set_size_inches with forward=True work with Tk
# backend, I changed the function signature but tried to keep
# it backward compatible. -JJL
# when a single parameter is given, consider it as a event
if height is None:
cbook.warn_deprecated("2.2", "FigureManagerTkAgg.resize now takes "
"width and height as separate arguments")
width = width.width
else:
self.canvas._tkcanvas.master.geometry("%dx%d" % (width, height))
if self.toolbar is not None:
self.toolbar.configure(width=width)
示例5: nearest_long
# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import warn_deprecated [as 别名]
def nearest_long(x):
cbook.warn_deprecated('3.0', removal='3.1', name='`nearest_long`',
obj_type='function', alternative='`round`')
if x >= 0:
return int(x + 0.5)
return int(x - 0.5)
示例6: remove_coding
# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import warn_deprecated [as 别名]
def remove_coding(text):
r"""Remove the coding comment, which six.exec\_ doesn't like."""
cbook.warn_deprecated('3.0', name='remove_coding', removal='3.1')
sub_re = re.compile(r"^#\s*-\*-\s*coding:\s*.*-\*-$", flags=re.MULTILINE)
return sub_re.sub("", text)
# -----------------------------------------------------------------------------
# Template
# -----------------------------------------------------------------------------
示例7: __init__
# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import warn_deprecated [as 别名]
def __init__(self, *args, **kwargs):
if args and isinstance(args[0], wx.EvtHandler):
cbook.warn_deprecated(
"3.0", message="Passing a wx.EvtHandler as first argument to "
"the TimerWx constructor is deprecated since %(since)s.")
args = args[1:]
TimerBase.__init__(self, *args, **kwargs)
self._timer = wx.Timer()
self._timer.Notify = self._on_timer
示例8: validate_mathtext_default
# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import warn_deprecated [as 别名]
def validate_mathtext_default(s):
if s == "circled":
cbook.warn_deprecated(
"3.1", message="Support for setting the mathtext.default rcParam "
"to 'circled' is deprecated since %(since)s and will be removed "
"%(removal)s.")
return ValidateInStrings(
'default',
"rm cal it tt sf bf default bb frak circled scr regular".split())(s)
示例9: remove_coding
# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import warn_deprecated [as 别名]
def remove_coding(text):
r"""
Remove the coding comment, which six.exec\_ doesn't like.
"""
cbook.warn_deprecated('3.0', name='remove_coding', removal='3.1')
sub_re = re.compile(r"^#\s*-\*-\s*coding:\s*.*-\*-$", flags=re.MULTILINE)
return sub_re.sub("", text)
#------------------------------------------------------------------------------
# Template
#------------------------------------------------------------------------------
示例10: __init__
# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import warn_deprecated [as 别名]
def __init__(self, *args, **kwargs):
if args and isinstance(args[0], wx.EvtHandler):
cbook.warn_deprecated(
"3.0", "Passing a wx.EvtHandler as first argument to the "
"TimerWx constructor is deprecated since %(version)s.")
args = args[1:]
TimerBase.__init__(self, *args, **kwargs)
self._timer = wx.Timer()
self._timer.Notify = self._on_timer
示例11: validate_svg_fonttype
# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import warn_deprecated [as 别名]
def validate_svg_fonttype(s):
if s in ["none", "path"]:
return s
if s == "svgfont":
cbook.warn_deprecated(
"2.2", "'svgfont' support for svg.fonttype is deprecated.")
return s
raise ValueError("Unrecognized svg.fonttype string '{}'; "
"valid strings are 'none', 'path'")
示例12: new_saved_frame_seq
# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import warn_deprecated [as 别名]
def new_saved_frame_seq(self):
# Generate an iterator for the sequence of saved data. If there are
# no saved frames, generate a new frame sequence and take the first
# save_count entries in it.
if self._save_seq:
# While iterating we are going to update _save_seq
# so make a copy to safely iterate over
self._old_saved_seq = list(self._save_seq)
return iter(self._old_saved_seq)
else:
if self.save_count is not None:
return itertools.islice(self.new_frame_seq(), self.save_count)
else:
frame_seq = self.new_frame_seq()
def gen():
try:
for _ in range(100):
yield next(frame_seq)
except StopIteration:
pass
else:
cbook.warn_deprecated(
"2.2", "FuncAnimation.save has truncated your "
"animation to 100 frames. In the future, no such "
"truncation will occur; please pass 'save_count' "
"accordingly.")
return gen()