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


Python PathPatch.set_edgecolor方法代码示例

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


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

示例1: make_path

# 需要导入模块: from matplotlib.patches import PathPatch [as 别名]
# 或者: from matplotlib.patches.PathPatch import set_edgecolor [as 别名]
def make_path(d, style):
    items = []
    for c in d.split():
        if c.upper() in codemap:
            items.append(c)
        else:
            x, y = (float(v) for v in c.split(","))
            items.append((x, y))
    codes = []
    vertices = []            
    i = 0
    lx, ly = 0, 0
    last_code = "M"
    while i < len(items):
        code = items[i]
        if not isinstance(code, str):
            code = last_code
        else:
            i += 1
        ucode = code.upper()
        if code.isupper():
            relative = False
        else:
            relative = True
        if ucode in ("M", "L"):
            x, y = items[i]
            i += 1
            if relative:
                x += lx
                y += ly
            codes.append(codemap[ucode])
            vertices.append((x, y))
            lx, ly = x, y
        if ucode == "C":
            if not relative:
                points = items[i:i+3]
            else:
                points = [(_x + lx, _y + ly) for _x, _y in items[i:i+3]]
            codes.extend([codemap[ucode]]*3)
            vertices.extend(points)
            lx, ly = points[-1]
            i += 3
        if ucode == "Z":
            break
        last_code = code
        
    codes[0] = Path.MOVETO
    patch = PathPatch( Path(vertices, codes) )
    patch.set_linewidth( get_number(style.get("stroke-width", "1px") ) )
    fill =  style.get("fill", "none")
    if fill == "none":
        patch.set_fill( None )
    else:
        patch.set_facecolor( fill )
    edge = style.get("stroke", "none")
    patch.set_edgecolor(edge)

    return patch
开发者ID:hejibo,项目名称:scpy2,代码行数:60,代码来源:svg_path.py

示例2: _render_on_subplot

# 需要导入模块: from matplotlib.patches import PathPatch [as 别名]
# 或者: from matplotlib.patches.PathPatch import set_edgecolor [as 别名]
    def _render_on_subplot(self, subplot):
        """
        Render this Bezier path in a subplot.  This is the key function that
        defines how this Bezier path graphics primitive is rendered in matplotlib's
        library.

        TESTS::

            sage: bezier_path([[(0,1),(.5,0),(1,1)]])
            Graphics object consisting of 1 graphics primitive

        ::

            sage: bezier_path([[(0,1),(.5,0),(1,1),(-3,5)]])
            Graphics object consisting of 1 graphics primitive
        """
        from matplotlib.patches import PathPatch
        from matplotlib.path import Path
        from sage.plot.misc import get_matplotlib_linestyle

        options = dict(self.options())

        del options['alpha']
        del options['thickness']
        del options['rgbcolor']
        del options['zorder']
        del options['fill']
        del options['linestyle']

        bpath = Path(self.vertices, self.codes)
        bpatch = PathPatch(bpath, **options)
        options = self.options()
        bpatch.set_linewidth(float(options['thickness']))
        bpatch.set_fill(options['fill'])
        bpatch.set_zorder(options['zorder'])
        a = float(options['alpha'])
        bpatch.set_alpha(a)
        c = to_mpl_color(options['rgbcolor'])
        bpatch.set_edgecolor(c)
        bpatch.set_facecolor(c)
        bpatch.set_linestyle(get_matplotlib_linestyle(options['linestyle'], return_type='long'))
        subplot.add_patch(bpatch)
开发者ID:mcognetta,项目名称:sage,代码行数:44,代码来源:bezier_path.py


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