本文整理汇总了Python中transforms.Bbox.from_bounds方法的典型用法代码示例。如果您正苦于以下问题:Python Bbox.from_bounds方法的具体用法?Python Bbox.from_bounds怎么用?Python Bbox.from_bounds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类transforms.Bbox
的用法示例。
在下文中一共展示了Bbox.from_bounds方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from transforms import Bbox [as 别名]
# 或者: from transforms.Bbox import from_bounds [as 别名]
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