本文整理汇总了Python中matplotlib.path.Path.append方法的典型用法代码示例。如果您正苦于以下问题:Python Path.append方法的具体用法?Python Path.append怎么用?Python Path.append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.path.Path
的用法示例。
在下文中一共展示了Path.append方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: shortestPath
# 需要导入模块: from matplotlib.path import Path [as 别名]
# 或者: from matplotlib.path.Path import append [as 别名]
def shortestPath(G,start,end):
"""
Find a single shortest path from the given start vertex
to the given end vertex.
The input has the same conventions as Dijkstra().
The output is a list of the vertices in order along
the shortest path.
"""
D,P = Dijkstra(G,start,end)
Path = []
while 1:
Path.append(end)
if end == start: break
end = P[end]
Path.reverse()
return Path
示例2: Path
# 需要导入模块: from matplotlib.path import Path [as 别名]
# 或者: from matplotlib.path.Path import append [as 别名]
lw = 25.0
verts = np.array([[-0.1, -0.5],
[ 0.0, +0.5],
[+0.1, -0.5]])
verts = verts*200 + (400,400)
codes = [Path.MOVETO, Path.LINETO,Path.LINETO ]
path = Path(verts, codes)
patch = patches.PathPatch(path, facecolor='none', lw=lw, alpha=.25)
patch.set_path_effects([PathEffects.Stroke(capstyle='butt')])
axes.add_patch(patch)
path = PathCollection()
path.append(verts)
w = lw/2.0
P = []
for vertex in path[0].vertices:
position = vertex['a_position']
segment = vertex['a_segment']
t1 = vertex['a_tangents'][:2]
t1 /= np.sqrt(((t1*t1)).sum())
t2 = vertex['a_tangents'][2:]
t2 /= np.sqrt(((t2*t2)).sum())
u,v = vertex['a_texcoord']
angle = np.arctan2 (t1[0]*t2[1]-t1[1]*t2[0], t1[0]*t2[0]+t1[1]*t2[1])
t = t1+t2
t /= np.sqrt(((t*t)).sum())
o = np.array([t[1], -t[0]])