本文整理汇总了Python中matplotlib.patches.PathPatch.get_verts方法的典型用法代码示例。如果您正苦于以下问题:Python PathPatch.get_verts方法的具体用法?Python PathPatch.get_verts怎么用?Python PathPatch.get_verts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.patches.PathPatch
的用法示例。
在下文中一共展示了PathPatch.get_verts方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: BezierHitTest
# 需要导入模块: from matplotlib.patches import PathPatch [as 别名]
# 或者: from matplotlib.patches.PathPatch import get_verts [as 别名]
def BezierHitTest(path, x0, y0):
from matplotlib.patches import PathPatch
import ifigure.widgets.canvas.custom_picker as cpicker
segpath = BezierSplit(path)
i = 0
for seg in segpath:
p = [(item[0], item[1]) for item in seg]
codes, verts = zip(*p)
obj = matplotlib.path.Path(verts, codes)
a = PathPatch(obj)
xy= a.get_verts()
if len(xy) == 0: ## this case happens when verts has only two points in mpl1.5
x = [v[0] for v in verts]
y = [v[1] for v in verts]
else:
x = np.transpose(xy)[0]
y = np.transpose(xy)[1]
hit, idx = cpicker.CheckLineHit(x, y, x0, y0)
if hit: return True, i
i = i+1
return False, -1