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


Python bezier.get_cos_sin方法代码示例

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


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

示例1: _extend_path

# 需要导入模块: from matplotlib import bezier [as 别名]
# 或者: from matplotlib.bezier import get_cos_sin [as 别名]
def _extend_path(self, path, mutation_size=10):
            """
            Extend the path to make a room for drawing arrow.
            """
            from matplotlib.bezier import get_cos_sin

            x0, y0 = path.vertices[-2]
            x1, y1 = path.vertices[-1]
            cost, sint = get_cos_sin(x0, y0, x1, y1)

            d = mutation_size * 1.
            x2, y2 = x1 + cost*d, y1+sint*d

            if path.codes is None:
                _path = Path(np.concatenate([path.vertices, [[x2, y2]]]))
            else:
                _path = Path(np.concatenate([path.vertices, [[x2, y2]]]),
                             np.concatenate([path.codes, [Path.LINETO]]))

            return _path 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:22,代码来源:axisline_style.py

示例2: transmute

# 需要导入模块: from matplotlib import bezier [as 别名]
# 或者: from matplotlib.bezier import get_cos_sin [as 别名]
def transmute(self, path, mutation_size, linewidth):

            if self.scaleA is None:
                scaleA = mutation_size
            else:
                scaleA = self.scaleA

            if self.scaleB is None:
                scaleB = mutation_size
            else:
                scaleB = self.scaleB

            vertices_list, codes_list = [], []

            if self.bracketA:
                x0, y0 = path.vertices[0]
                x1, y1 = path.vertices[1]
                cos_t, sin_t = get_cos_sin(x1, y1, x0, y0)
                verticesA, codesA = self._get_bracket(x0, y0, cos_t, sin_t,
                                                      self.widthA * scaleA,
                                                      self.lengthA * scaleA)
                vertices_list.append(verticesA)
                codes_list.append(codesA)

            vertices_list.append(path.vertices)
            codes_list.append(path.codes)

            if self.bracketB:
                x0, y0 = path.vertices[-1]
                x1, y1 = path.vertices[-2]
                cos_t, sin_t = get_cos_sin(x1, y1, x0, y0)
                verticesB, codesB = self._get_bracket(x0, y0, cos_t, sin_t,
                                                      self.widthB * scaleB,
                                                      self.lengthB * scaleB)
                vertices_list.append(verticesB)
                codes_list.append(codesB)

            vertices = np.concatenate(vertices_list)
            codes = np.concatenate(codes_list)

            p = Path(vertices, codes)

            return p, False 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:45,代码来源:patches.py


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