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


Python PatchCollection.set_offsets方法代码示例

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


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

示例1: do_3d_projection

# 需要导入模块: from matplotlib.collections import PatchCollection [as 别名]
# 或者: from matplotlib.collections.PatchCollection import set_offsets [as 别名]
    def do_3d_projection(self, renderer):
        xs, ys, zs = self._offsets3d
        vxs, vys, vzs, vis = proj3d.proj_transform_clip(xs, ys, zs, renderer.M)
        #FIXME: mpl allows us no way to unset the collection alpha value
        self._alpha = None
        self.set_facecolors(zalpha(self._facecolor3d, vzs))
        self.set_edgecolors(zalpha(self._edgecolor3d, vzs))
        PatchCollection.set_offsets(self, list(zip(vxs, vys)))

        if vzs.size > 0 :
            return min(vzs)
        else :
            return np.nan
开发者ID:BlackEarth,项目名称:portable-python-win32,代码行数:15,代码来源:art3d.py

示例2: do_3d_projection

# 需要导入模块: from matplotlib.collections import PatchCollection [as 别名]
# 或者: from matplotlib.collections.PatchCollection import set_offsets [as 别名]
    def do_3d_projection(self, renderer):
        xs, ys, zs = self._offsets3d
        vxs, vys, vzs, vis = proj3d.proj_transform_clip(xs, ys, zs, renderer.M)

        fcs = zalpha(self._facecolor3d, vzs) if self._depthshade else self._facecolor3d
        fcs = mcolors.colorConverter.to_rgba_array(fcs, self._alpha)
        self.set_facecolors(fcs)

        ecs = zalpha(self._edgecolor3d, vzs) if self._depthshade else self._edgecolor3d
        ecs = mcolors.colorConverter.to_rgba_array(ecs, self._alpha)
        self.set_edgecolors(ecs)
        PatchCollection.set_offsets(self, list(zip(vxs, vys)))

        if vzs.size > 0:
            return min(vzs)
        else:
            return np.nan
开发者ID:JulianNymark,项目名称:blendergame,代码行数:19,代码来源:art3d.py

示例3: render

# 需要导入模块: from matplotlib.collections import PatchCollection [as 别名]
# 或者: from matplotlib.collections.PatchCollection import set_offsets [as 别名]
    def render(self, patch_size=0.5, alpha=1.0, x_offset=100):
        '''Draws the legend graphic and saves it to a file.'''
        n = len(self.colors)
        s = patch_size

        # This offset is transformed to "data" coordinates (inches)
        left_offset = (-s * 1.5) - (x_offset / self.dpi)

        # Create grid to plot the artists
        grid = np.concatenate((
            np.zeros(n).reshape(n, 1),
            np.arange(-n, 1)[1:].reshape(n, 1)
        ), axis=1)

        plt.text(left_offset, 1.1, 'Legend', family='sans-serif',
            size=14, weight='bold', color='#ffffff')

        patches = []
        for i in range(n):
            # Add a rectangle
            rect = mpatches.Rectangle(grid[i] - [0, 0], s, s, ec='none')
            patches.append(rect)
            self.__label__(grid[i], self.labels[i], x_offset)

        collection = PatchCollection(patches, alpha=alpha)

        # Space the patches and the text labels
        collection.set_offset_position('data')
        collection.set_offsets(np.array([
            [left_offset, 0]
        ]))

        collection.set_facecolors(self.colors)
        #collection.set_edgecolor('#ffffff') # Draw color for box outlines

        self.axis.add_collection(collection)

        plt.axis('equal')
        plt.axis('off')
        plt.savefig(self.file_path, facecolor=self.bg_color, dpi=self.dpi,
            pad_inches=0)

        return self.file_path
开发者ID:arthur-e,项目名称:flux-python-api,代码行数:45,代码来源:outputs.py


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