本文整理汇总了Python中sage.plot.primitive.GraphicPrimitive_xydata.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python GraphicPrimitive_xydata.__init__方法的具体用法?Python GraphicPrimitive_xydata.__init__怎么用?Python GraphicPrimitive_xydata.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sage.plot.primitive.GraphicPrimitive_xydata
的用法示例。
在下文中一共展示了GraphicPrimitive_xydata.__init__方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from sage.plot.primitive import GraphicPrimitive_xydata [as 别名]
# 或者: from sage.plot.primitive.GraphicPrimitive_xydata import __init__ [as 别名]
def __init__(self, xdata, ydata, options):
"""
Initializes base class Polygon.
EXAMPLES::
sage: P = polygon([(0,0), (1,1), (-1,3)], thickness=2)
sage: P[0].xdata
[0.0, 1.0, -1.0]
sage: P[0].options()['thickness']
2
"""
self.xdata = xdata
self.ydata = ydata
GraphicPrimitive_xydata.__init__(self, options)
示例2: __init__
# 需要导入模块: from sage.plot.primitive import GraphicPrimitive_xydata [as 别名]
# 或者: from sage.plot.primitive.GraphicPrimitive_xydata import __init__ [as 别名]
def __init__(self, xdata, ydata, options):
"""
Initializes base class Point.
EXAMPLES::
sage: P = point((3,4))
sage: P[0].xdata
[3.0]
sage: P[0].options()['alpha']
1
"""
self.xdata = xdata
self.ydata = ydata
GraphicPrimitive_xydata.__init__(self, options)
示例3: __init__
# 需要导入模块: from sage.plot.primitive import GraphicPrimitive_xydata [as 别名]
# 或者: from sage.plot.primitive.GraphicPrimitive_xydata import __init__ [as 别名]
def __init__(self, xdata, ydata, options):
"""
Initialize a line graphics primitive.
EXAMPLES::
sage: from sage.plot.line import Line
sage: Line([-1,2], [17,4], {'thickness':2})
Line defined by 2 points
"""
valid_options = self._allowed_options().keys()
for opt in options.iterkeys():
if opt not in valid_options:
raise RuntimeError("Error in line(): option '%s' not valid."%opt)
self.xdata = xdata
self.ydata = ydata
GraphicPrimitive_xydata.__init__(self, options)
示例4: __init__
# 需要导入模块: from sage.plot.primitive import GraphicPrimitive_xydata [as 别名]
# 或者: from sage.plot.primitive.GraphicPrimitive_xydata import __init__ [as 别名]
def __init__(self, path, options):
"""
Returns a graphics primitive of a path of Bezier curves.
EXAMPLES::
sage: from sage.plot.bezier_path import BezierPath
sage: BezierPath([[(0,0),(.5,.5),(1,0)],[(.5,1),(0,0)]],{'linestyle':'dashed'})
Bezier path from (0, 0) to (0, 0)
"""
import numpy as np
self.path = path
codes = [1] + (len(self.path[0])-1)*[len(self.path[0])]
vertices = self.path[0]
for curve in self.path[1:]:
vertices += curve
codes += (len(curve))*[len(curve)+1]
self.codes = codes
self.vertices = np.array(vertices, np.float)
GraphicPrimitive_xydata.__init__(self, options)