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


Python PathPatch.set方法代码示例

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


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

示例1: MplPathROI

# 需要导入模块: from matplotlib.patches import PathPatch [as 别名]
# 或者: from matplotlib.patches.PathPatch import set [as 别名]
class MplPathROI(MplPolygonalROI):

    def roi_factory(self):
        return Path()

    def _setup_patch(self):
        self._patch = None

    def _sync_patch(self):
        if self._patch is not None:
            self._patch.remove()
            self._patch = None

        # Update geometry
        if not self._roi.defined():
            return
        else:
            x, y = self._roi.to_polygon()
            p = MplPath(np.column_stack((x, y)))
            self._patch = PathPatch(p)
            self._patch.set_visible(True)

        # Update appearance
        self._patch.set(**self.plot_opts)

        # Refresh
        self._axes.figure.canvas.draw()

    def finalize_selection(self, event):
        self._mid_selection = False
        if self._patch is not None:
            self._patch.set_visible(False)
        self._axes.figure.canvas.draw()
开发者ID:saimn,项目名称:glue,代码行数:35,代码来源:roi.py

示例2: MplPathROI

# 需要导入模块: from matplotlib.patches import PathPatch [as 别名]
# 或者: from matplotlib.patches.PathPatch import set [as 别名]
class MplPathROI(MplPolygonalROI):
    """
    Matplotlib ROI for path selections

    Parameters
    ----------
    axes : `~matplotlib.axes.Axes`
        The Matplotlib axes to draw to.
    """

    _roi_cls = Path

    def __init__(self, axes, roi=None):

        super(MplPolygonalROI, self).__init__(axes)

        self.plot_opts = {'edgecolor': PATCH_COLOR,
                          'facecolor': PATCH_COLOR,
                          'alpha': 0.3}

        self._patch = None

    def _sync_patch(self):

        if self._patch is not None:
            self._patch.remove()
            self._patch = None

        if self._roi.defined():
            x, y = self._roi.to_polygon()
            p = MplPath(np.column_stack((x, y)))
            self._patch = PathPatch(p)
            self._patch.set_visible(True)
            self._patch.set(**self.plot_opts)

    def finalize_selection(self, event):
        self._mid_selection = False
        if self._patch is not None:
            self._patch.set_visible(False)
        self._draw()
开发者ID:glue-viz,项目名称:glue,代码行数:42,代码来源:roi.py


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