本文整理汇总了Python中transforms.TransformedBbox类的典型用法代码示例。如果您正苦于以下问题:Python TransformedBbox类的具体用法?Python TransformedBbox怎么用?Python TransformedBbox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TransformedBbox类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(
self,
figsize=None, # defaults to rc figure.figsize
dpi=None, # defaults to rc figure.dpi
facecolor=None, # defaults to rc figure.facecolor
edgecolor=None, # defaults to rc figure.edgecolor
linewidth=0.0, # the default linewidth of the frame
frameon=True, # whether or not to draw the figure frame
subplotpars=None, # default to rc
):
"""
*figsize*
w,h tuple in inches
*dpi*
Dots per inch
*facecolor*
The figure patch facecolor; defaults to rc ``figure.facecolor``
*edgecolor*
The figure patch edge color; defaults to rc ``figure.edgecolor``
*linewidth*
The figure patch edge linewidth; the default linewidth of the frame
*frameon*
If *False*, suppress drawing the figure frame
*subplotpars*
A :class:`SubplotParams` instance, defaults to rc
"""
Artist.__init__(self)
self.callbacks = cbook.CallbackRegistry()
if figsize is None:
figsize = rcParams["figure.figsize"]
if dpi is None:
dpi = rcParams["figure.dpi"]
if facecolor is None:
facecolor = rcParams["figure.facecolor"]
if edgecolor is None:
edgecolor = rcParams["figure.edgecolor"]
self.dpi_scale_trans = Affine2D()
self.dpi = dpi
self.bbox_inches = Bbox.from_bounds(0, 0, *figsize)
self.bbox = TransformedBbox(self.bbox_inches, self.dpi_scale_trans)
self.frameon = frameon
self.transFigure = BboxTransformTo(self.bbox)
# the figurePatch name is deprecated
self.patch = self.figurePatch = Rectangle(
xy=(0, 0), width=1, height=1, facecolor=facecolor, edgecolor=edgecolor, linewidth=linewidth
)
self._set_artist_props(self.patch)
self.patch.set_aa(False)
self._hold = rcParams["axes.hold"]
self.canvas = None
if subplotpars is None:
subplotpars = SubplotParams()
self.subplotpars = subplotpars
self._axstack = AxesStack() # track all figure axes and current axes
self.clf()
self._cachedRenderer = None
开发者ID:jjs0sbw,项目名称:CSPLN,代码行数:72,代码来源:figure.py
示例2: Figure
class Figure(Artist):
"""
The Figure instance supports callbacks through a *callbacks*
attribute which is a :class:`matplotlib.cbook.CallbackRegistry`
instance. The events you can connect to are 'dpi_changed', and
the callback will be called with ``func(fig)`` where fig is the
:class:`Figure` instance.
The figure patch is drawn by a the attribute
*patch*
a :class:`matplotlib.patches.Rectangle` instance
*suppressComposite*
for multiple figure images, the figure will make composite
images depending on the renderer option_image_nocomposite
function. If suppressComposite is True|False, this will
override the renderer
"""
def __str__(self):
return "Figure(%gx%g)" % tuple(self.bbox.size)
def __init__(
self,
figsize=None, # defaults to rc figure.figsize
dpi=None, # defaults to rc figure.dpi
facecolor=None, # defaults to rc figure.facecolor
edgecolor=None, # defaults to rc figure.edgecolor
linewidth=1.0, # the default linewidth of the frame
frameon=True, # whether or not to draw the figure frame
subplotpars=None, # default to rc
):
"""
*figsize*
w,h tuple in inches
*dpi*
dots per inch
*facecolor*
the figure patch facecolor; defaults to rc ``figure.facecolor``
*edgecolor*
the figure patch edge color; defaults to rc ``figure.edgecolor``
*linewidth*
the figure patch edge linewidth; the default linewidth of the frame
*frameon*
if False, suppress drawing the figure frame
*subplotpars*
a :class:`SubplotParams` instance, defaults to rc
"""
Artist.__init__(self)
self.callbacks = cbook.CallbackRegistry(("dpi_changed",))
if figsize is None:
figsize = rcParams["figure.figsize"]
if dpi is None:
dpi = rcParams["figure.dpi"]
if facecolor is None:
facecolor = rcParams["figure.facecolor"]
if edgecolor is None:
edgecolor = rcParams["figure.edgecolor"]
self.dpi_scale_trans = Affine2D()
self.dpi = dpi
self.bbox_inches = Bbox.from_bounds(0, 0, *figsize)
self.bbox = TransformedBbox(self.bbox_inches, self.dpi_scale_trans)
self.frameon = frameon
self.transFigure = BboxTransformTo(self.bbox)
# the figurePatch name is deprecated
self.patch = self.figurePatch = Rectangle(
xy=(0, 0), width=1, height=1, facecolor=facecolor, edgecolor=edgecolor, linewidth=linewidth
)
self._set_artist_props(self.patch)
self._hold = rcParams["axes.hold"]
self.canvas = None
if subplotpars is None:
subplotpars = SubplotParams()
self.subplotpars = subplotpars
self._axstack = Stack() # maintain the current axes
self.axes = []
self.clf()
self._cachedRenderer = None
def _get_dpi(self):
return self._dpi
def _set_dpi(self, dpi):
self._dpi = dpi
self.dpi_scale_trans.clear().scale(dpi, dpi)
self.callbacks.process("dpi_changed", self)
dpi = property(_get_dpi, _set_dpi)
#.........这里部分代码省略.........
开发者ID:08s011003,项目名称:nupic,代码行数:101,代码来源:figure.py
注:本文中的transforms.TransformedBbox类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论