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


Python Bbox.from_extents方法代码示例

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


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

示例1: UpdateExtents

# 需要导入模块: from matplotlib.transforms import Bbox [as 别名]
# 或者: from matplotlib.transforms.Bbox import from_extents [as 别名]
def UpdateExtents(self, products):
        """
        更新产品参数的extents
        :param products: 产品参数对象
        :return: 
        """
        if products.picture.extents is None:
            maxlon = max(self.endlon, self.beginlon)
            minlon = min(self.endlon, self.beginlon)
            maxlat = max(self.endlat, self.beginlat)
            minlat = min(self.endlat, self.beginlat)
            margin = products.picture.margin
            xmax = maxlon + margin[2] if maxlon + margin[2] <= 180 else 180
            xmin = minlon - margin[0] if minlon - margin[0] >= -180 else -180
            ymax = maxlat + margin[1] if maxlat + margin[1] <= 90 else 90
            ymin = minlat - margin[3] if minlat - margin[3] >= -90 else -90
            products.picture.extents = Bbox.from_extents(xmin, ymin, xmax, ymax)
        else:
            extents = products.picture.extents
            if isinstance(extents, list):
                products.picture.extents = Bbox.from_extents(extents[0], extents[1], extents[2], extents[3]) 
开发者ID:flashlxy,项目名称:PyMICAPS,代码行数:23,代码来源:MicapsData.py

示例2: get_position

# 需要导入模块: from matplotlib.transforms import Bbox [as 别名]
# 或者: from matplotlib.transforms.Bbox import from_extents [as 别名]
def get_position(self, figure, return_all=False):
        """Update the subplot position from ``figure.subplotpars``.
        """
        gridspec = self.get_gridspec()
        nrows, ncols = gridspec.get_geometry()
        rows, cols = np.unravel_index(
            [self.num1] if self.num2 is None else [self.num1, self.num2],
            (nrows, ncols))
        fig_bottoms, fig_tops, fig_lefts, fig_rights = \
            gridspec.get_grid_positions(figure)

        fig_bottom = fig_bottoms[rows].min()
        fig_top = fig_tops[rows].max()
        fig_left = fig_lefts[cols].min()
        fig_right = fig_rights[cols].max()
        figbox = Bbox.from_extents(fig_left, fig_bottom, fig_right, fig_top)

        if return_all:
            return figbox, rows[0], cols[0], nrows, ncols
        else:
            return figbox 
开发者ID:PacktPublishing,项目名称:Mastering-Elasticsearch-7.0,代码行数:23,代码来源:gridspec.py

示例3: get_position

# 需要导入模块: from matplotlib.transforms import Bbox [as 别名]
# 或者: from matplotlib.transforms.Bbox import from_extents [as 别名]
def get_position(self, figure, return_all=False):
        """
        Update the subplot position from ``figure.subplotpars``.
        """
        gridspec = self.get_gridspec()
        nrows, ncols = gridspec.get_geometry()
        rows, cols = np.unravel_index(
            [self.num1] if self.num2 is None else [self.num1, self.num2],
            (nrows, ncols))
        fig_bottoms, fig_tops, fig_lefts, fig_rights = \
            gridspec.get_grid_positions(figure)

        fig_bottom = fig_bottoms[rows].min()
        fig_top = fig_tops[rows].max()
        fig_left = fig_lefts[cols].min()
        fig_right = fig_rights[cols].max()
        figbox = Bbox.from_extents(fig_left, fig_bottom, fig_right, fig_top)

        if return_all:
            return figbox, rows[0], cols[0], nrows, ncols
        else:
            return figbox 
开发者ID:boris-kz,项目名称:CogAlg,代码行数:24,代码来源:gridspec.py

示例4: __init__

# 需要导入模块: from matplotlib.transforms import Bbox [as 别名]
# 或者: from matplotlib.transforms.Bbox import from_extents [as 别名]
def __init__(self, root, clipborders):
        p = root.find("Picture")
        # 生成的图片宽度
        self.width = Projection.leaf_to_float(p, "PicWidth", 10)

        # 生成的图片高度
        self.height = Projection.leaf_to_float(p, "PicHeight", 10)

        # dpi
        self.dpi = Projection.leaf_to_int(p, "Dpi", 72)

        # 高宽比
        self.widthshrink = Projection.leaf_to_float(p, "WidthShrink", 1.0)

        # 绘图区外延
        self.margin = Projection.leaf_to_list(p, "Margin", [0, 0, 0, 0])

        # 绘图区内边距
        self.pad = Projection.leaf_to_float(p, "Pad", 0.0)

        # 绘图区域

        extents = p.find("Extents").text.strip()
        if extents is None or extents == '':
            if len(clipborders) < 1 or clipborders[0].path is None or (not clipborders[0].using):
                self.extents = None
            else:
                jxextend = clipborders[0].path.get_extents()
                delta = self.margin
                xmax = jxextend.xmax + delta[2]
                xmin = jxextend.xmin - delta[0]
                ymax = jxextend.ymax + delta[1]
                ymin = jxextend.ymin - delta[3]
                self.extents = Bbox.from_extents(xmin, ymin, xmax, ymax)
        else:
            self.extents = Projection.leaf_to_list(p, "Extents", None)

        # 画布透明度
        self.opacity = Projection.leaf_to_float(p, 'Opacity', 1)
        if self.opacity < 0 or self.opacity > 1:
            self.opacity = 1

        # 生成的图片文件存放路径
        self.picfile = Projection.leaf_to_string(p, 'PicFile', 'mytest.png')
        self.checkFilename()

        return 
开发者ID:flashlxy,项目名称:PyMICAPS,代码行数:49,代码来源:Picture.py


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