本文整理匯總了Python中matplotlib.mlab.quad2cubic方法的典型用法代碼示例。如果您正苦於以下問題:Python mlab.quad2cubic方法的具體用法?Python mlab.quad2cubic怎麽用?Python mlab.quad2cubic使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類matplotlib.mlab
的用法示例。
在下文中一共展示了mlab.quad2cubic方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: pathOperations
# 需要導入模塊: from matplotlib import mlab [as 別名]
# 或者: from matplotlib.mlab import quad2cubic [as 別名]
def pathOperations(path, transform, clip=None, simplify=None, sketch=None):
cmds = []
last_points = None
for points, code in path.iter_segments(transform, clip=clip,
simplify=simplify,
sketch=sketch):
if code == Path.MOVETO:
# This is allowed anywhere in the path
cmds.extend(points)
cmds.append(Op.moveto)
elif code == Path.CLOSEPOLY:
cmds.append(Op.closepath)
elif last_points is None:
# The other operations require a previous point
raise ValueError('Path lacks initial MOVETO')
elif code == Path.LINETO:
cmds.extend(points)
cmds.append(Op.lineto)
elif code == Path.CURVE3:
points = quad2cubic(*(list(last_points[-2:]) + list(points)))
cmds.extend(points[2:])
cmds.append(Op.curveto)
elif code == Path.CURVE4:
cmds.extend(points)
cmds.append(Op.curveto)
last_points = points
return cmds
示例2: _convert_path
# 需要導入模塊: from matplotlib import mlab [as 別名]
# 或者: from matplotlib.mlab import quad2cubic [as 別名]
def _convert_path(self, path, transform, clip=False, simplify=None):
ps = []
last_points = None
if clip:
clip = (0.0, 0.0, self.width * 72.0,
self.height * 72.0)
else:
clip = None
for points, code in path.iter_segments(transform, clip=clip,
simplify=simplify):
if code == Path.MOVETO:
ps.append("%g %g m" % tuple(points))
elif code == Path.CLOSEPOLY:
ps.append("cl")
elif last_points is None:
# The other operations require a previous point
raise ValueError('Path lacks initial MOVETO')
elif code == Path.LINETO:
ps.append("%g %g l" % tuple(points))
elif code == Path.CURVE3:
points = quad2cubic(*(list(last_points[-2:]) + list(points)))
ps.append("%g %g %g %g %g %g c" %
tuple(points[2:]))
elif code == Path.CURVE4:
ps.append("%g %g %g %g %g %g c" % tuple(points))
last_points = points
ps = "\n".join(ps)
return ps