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


Python GraphicPrimitive.__init__方法代码示例

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


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

示例1: __init__

# 需要导入模块: from sage.plot.primitive import GraphicPrimitive [as 别名]
# 或者: from sage.plot.primitive.GraphicPrimitive import __init__ [as 别名]
    def __init__(self, xpos_array, ypos_array, xvec_array, yvec_array, options):
        """
        Create the graphics primitive PlotField.  This sets options
        and the array to be plotted as attributes.

        EXAMPLES::

            sage: x,y = var('x,y')
            sage: R=plot_slope_field(x+y,(x,0,1),(y,0,1),plot_points=2)
            sage: r=R[0]
            sage: r.options()['headlength']
            0
            sage: r.xpos_array
            [0.0, 0.0, 1.0, 1.0]
            sage: r.yvec_array
            masked_array(data = [0.0 0.707106781187 0.707106781187 0.894427191],
                         mask = [False False False False],
                   fill_value = 1e+20)

        TESTS:

        We test dumping and loading a plot::

            sage: x,y = var('x,y')
            sage: P = plot_vector_field((sin(x), cos(y)), (x,-3,3), (y,-3,3))
            sage: Q = loads(dumps(P))
        """
        self.xpos_array = xpos_array
        self.ypos_array = ypos_array
        self.xvec_array = xvec_array
        self.yvec_array = yvec_array
        GraphicPrimitive.__init__(self, options)
开发者ID:jwbober,项目名称:sagelib,代码行数:34,代码来源:plot_field.py

示例2: __init__

# 需要导入模块: from sage.plot.primitive import GraphicPrimitive [as 别名]
# 或者: from sage.plot.primitive.GraphicPrimitive import __init__ [as 别名]
    def __init__(self, point, r, angle, options):
        """
        Initializes base class ``Disk``.

        EXAMPLES::

            sage: D = disk((2,3), 1, (pi/2, pi), fill=False, color='red', thickness=1, alpha=.5)
            sage: D[0].x
            2.0
            sage: D[0].r
            1.0
            sage: D[0].rad1
            1.5707963267948966
            sage: D[0].options()['rgbcolor']
            'red'
            sage: D[0].options()['alpha']
            0.500000000000000
            sage: print loads(dumps(D))
            Graphics object consisting of 1 graphics primitive
        """
        self.x = float(point[0])
        self.y = float(point[1])
        self.r = float(r)
        self.rad1 = float(angle[0])
        self.rad2 = float(angle[1])
        GraphicPrimitive.__init__(self, options)
开发者ID:CETHop,项目名称:sage,代码行数:28,代码来源:disk.py

示例3: __init__

# 需要导入模块: from sage.plot.primitive import GraphicPrimitive [as 别名]
# 或者: from sage.plot.primitive.GraphicPrimitive import __init__ [as 别名]
    def __init__(self, ind, datalist, options):
        """
        Initialize a ``BarChart`` primitive.
        
        EXAMPLES::

            sage: from sage.plot.bar_chart import BarChart
            sage: BarChart(range(3), [10,3,5], {'width':0.7})
            BarChart defined by a 3 datalist 
        """
        self.datalist = datalist
        self.ind = ind
        GraphicPrimitive.__init__(self, options)        
开发者ID:bgxcpku,项目名称:sagelib,代码行数:15,代码来源:bar_chart.py

示例4: __init__

# 需要导入模块: from sage.plot.primitive import GraphicPrimitive [as 别名]
# 或者: from sage.plot.primitive.GraphicPrimitive import __init__ [as 别名]
    def __init__(self, xdata, ydata, options):
        """
        Scatter plot graphics primitive.

        EXAMPLES::

            sage: import numpy
            sage: from sage.plot.scatter_plot import ScatterPlot
            sage: ScatterPlot(numpy.array([0,1,2]), numpy.array([3.5,2,5.1]), {'facecolor':'white', 'marker':'s'})
            Scatter plot graphics primitive on 3 data points
        """
        self.xdata = xdata
        self.ydata = ydata
        GraphicPrimitive.__init__(self, options)
开发者ID:BlairArchibald,项目名称:sage,代码行数:16,代码来源:scatter_plot.py

示例5: __init__

# 需要导入模块: from sage.plot.primitive import GraphicPrimitive [as 别名]
# 或者: from sage.plot.primitive.GraphicPrimitive import __init__ [as 别名]
    def __init__(self, xtail, ytail, xhead, yhead, options):
        """
        Create an arrow graphics primitive.

        EXAMPLES::

            sage: from sage.plot.arrow import Arrow
            sage: Arrow(0,0,2,3,{})
            Arrow from (0.0,0.0) to (2.0,3.0) 
        """
        self.xtail = float(xtail)
        self.xhead = float(xhead)
        self.ytail = float(ytail)
        self.yhead = float(yhead)
        GraphicPrimitive.__init__(self, options)        
开发者ID:pombredanne,项目名称:sage-1,代码行数:17,代码来源:arrow.py

示例6: __init__

# 需要导入模块: from sage.plot.primitive import GraphicPrimitive [as 别名]
# 或者: from sage.plot.primitive.GraphicPrimitive import __init__ [as 别名]
    def __init__(self, datalist, options):
        """
        Initialize a ``Histogram`` primitive along with
        its options.

        EXAMPLES::

            sage: from sage.plot.histogram import Histogram
            sage: Histogram([10,3,5], {'width':0.7})
            Histogram defined by a data list of size 3
        """
        import numpy as np
        self.datalist=np.asarray(datalist,dtype=float)
        if 'linestyle' in options:
            from sage.plot.misc import get_matplotlib_linestyle
            options['linestyle'] = get_matplotlib_linestyle(
                    options['linestyle'], return_type='long')
        GraphicPrimitive.__init__(self, options)
开发者ID:robertwb,项目名称:sage,代码行数:20,代码来源:histogram.py

示例7: __init__

# 需要导入模块: from sage.plot.primitive import GraphicPrimitive [as 别名]
# 或者: from sage.plot.primitive.GraphicPrimitive import __init__ [as 别名]
    def __init__(self, xy_data_array, xrange, yrange, options):
        """
        Initializes base class DensityPlot.

        EXAMPLES::

            sage: x,y = var('x,y')
            sage: D = density_plot(x^2-y^3+10*sin(x*y), (x, -4, 4), (y, -4, 4),plot_points=121,cmap='hsv')
            sage: D[0].xrange
            (-4.0, 4.0)
            sage: D[0].options()['plot_points']
            121
        """
        self.xrange = xrange
        self.yrange = yrange
        self.xy_data_array = xy_data_array
        self.xy_array_row = len(xy_data_array)
        self.xy_array_col = len(xy_data_array[0])
        GraphicPrimitive.__init__(self, options)
开发者ID:ProgVal,项目名称:sage,代码行数:21,代码来源:density_plot.py

示例8: __init__

# 需要导入模块: from sage.plot.primitive import GraphicPrimitive [as 别名]
# 或者: from sage.plot.primitive.GraphicPrimitive import __init__ [as 别名]
    def __init__(self, string, point, options):
        """
        Initializes base class Text.

        EXAMPLES::

            sage: T = text("I like Fibonacci", (3,5))
            sage: t = T[0]
            sage: t.string
            'I like Fibonacci'
            sage: t.x
            3.0
            sage: t.options()['fontsize']
            10
        """
        self.string = string
        self.x = float(point[0])
        self.y = float(point[1])
        GraphicPrimitive.__init__(self, options)
开发者ID:drupel,项目名称:sage,代码行数:21,代码来源:text.py

示例9: __init__

# 需要导入模块: from sage.plot.primitive import GraphicPrimitive [as 别名]
# 或者: from sage.plot.primitive.GraphicPrimitive import __init__ [as 别名]
    def __init__(self, x, y, r1, r2, angle, s1, s2, options):
        """
        Initializes base class ``Arc``.

        EXAMPLES::

            sage: A = arc((2,3),1,1,pi/4,(0,pi))
            sage: A[0].x == 2
            True
            sage: A[0].y == 3
            True
            sage: A[0].r1 == 1
            True
            sage: A[0].r2 == 1
            True
            sage: bool(A[0].angle == pi/4)
            True
            sage: bool(A[0].s1 == 0)
            True
            sage: bool(A[0].s2 == pi)
            True

        TESTS::

            sage: from sage.plot.arc import Arc
            sage: a = Arc(0,0,1,1,0,0,1,{})
            sage: print loads(dumps(a))
            Arc with center (0.0,0.0) radii (1.0,1.0) angle 0.0 inside the sector (0.0,1.0)
        """
        self.x = float(x)
        self.y = float(y)
        self.r1 = float(r1)
        self.r2 = float(r2)
        if self.r1 <= 0 or self.r2 <= 0:
            raise ValueError("the radii must be positive real numbers.")

        self.angle = float(angle)
        self.s1 = float(s1)
        self.s2 = float(s2)
        if self.s2 < self.s1:
            self.s1,self.s2=self.s2,self.s1
        GraphicPrimitive.__init__(self, options)
开发者ID:BlairArchibald,项目名称:sage,代码行数:44,代码来源:arc.py

示例10: __init__

# 需要导入模块: from sage.plot.primitive import GraphicPrimitive [as 别名]
# 或者: from sage.plot.primitive.GraphicPrimitive import __init__ [as 别名]
    def __init__(self, xpos_array, ypos_array, xvec_array, yvec_array, options):
        """
        Create the graphics primitive StreamlinePlot. This sets options
        and the array to be plotted as attributes.

        EXAMPLES::

            sage: x, y = var('x y')
            sage: R = streamline_plot((sin(x), cos(y)), (x,0,1), (y,0,1), plot_points=2)
            sage: r = R[0]
            sage: r.options()['plot_points']
            2
            sage: r.xpos_array
            array([ 0.,  1.])
            sage: r.yvec_array
            masked_array(data =
             [[1.0 1.0]
             [0.5403023058681398 0.5403023058681398]],
                         mask =
             [[False False]
             [False False]],
                   fill_value = 1e+20)
            <BLANKLINE>

        TESTS:

        We test dumping and loading a plot::

            sage: x, y = var('x y')
            sage: P = streamline_plot((sin(x), cos(y)), (x,-3,3), (y,-3,3))
            sage: Q = loads(dumps(P))

        """
        self.xpos_array = xpos_array
        self.ypos_array = ypos_array
        self.xvec_array = xvec_array
        self.yvec_array = yvec_array
        GraphicPrimitive.__init__(self, options)
开发者ID:saraedum,项目名称:sage-renamed,代码行数:40,代码来源:streamline_plot.py

示例11: __init__

# 需要导入模块: from sage.plot.primitive import GraphicPrimitive [as 别名]
# 或者: from sage.plot.primitive.GraphicPrimitive import __init__ [as 别名]
    def __init__(self, xy_data_array, xrange, yrange, options):
        """
        Initializes base class MatrixPlot.

        EXAMPLES::

            sage: M = matrix_plot([[mod(i,5)^j for i in range(5)] for j in range(1,6)], cmap='jet')
            sage: M[0].xrange
            (0, 5)
            sage: M[0].options()['cmap']
            'jet'
            sage: M[0].xy_array_row
            5
        """
        self.xrange = xrange
        self.yrange = yrange
        self.xy_data_array = xy_data_array
        if hasattr(xy_data_array, 'shape'):
            self.xy_array_row = xy_data_array.shape[0]
            self.xy_array_col = xy_data_array.shape[1]
        else:
            self.xy_array_row = len(xy_data_array)
            self.xy_array_col = len(xy_data_array[0])
        GraphicPrimitive.__init__(self, options)
开发者ID:BlairArchibald,项目名称:sage,代码行数:26,代码来源:matrix_plot.py


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