本文整理汇总了Python中sage.plot.primitive.GraphicPrimitive类的典型用法代码示例。如果您正苦于以下问题:Python GraphicPrimitive类的具体用法?Python GraphicPrimitive怎么用?Python GraphicPrimitive使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GraphicPrimitive类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
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,代码行数:32,代码来源:plot_field.py
示例2: __init__
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,代码行数:26,代码来源:disk.py
示例3: __init__
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,代码行数:13,代码来源:bar_chart.py
示例4: __init__
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,代码行数:14,代码来源:scatter_plot.py
示例5: __init__
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,代码行数:15,代码来源:arrow.py
示例6: _plot3d_options
def _plot3d_options(self, options=None):
"""
Translate 2D plot options into 3D plot options.
EXAMPLES::
sage: P = arrow((0,1), (2,3), width=5)
sage: p=P[0]; p
Arrow from (0.0,1.0) to (2.0,3.0)
sage: q=p.plot3d()
sage: q.thickness
5
"""
if options == None:
options = self.options()
options = dict(self.options())
options_3d = {}
if 'width' in options:
options_3d['thickness'] = options['width']
del options['width']
# ignore zorder and head in 3d plotting
if 'zorder' in options:
del options['zorder']
if 'head' in options:
del options['head']
if 'linestyle' in options:
del options['linestyle']
options_3d.update(GraphicPrimitive._plot3d_options(self, options))
return options_3d
开发者ID:pombredanne,项目名称:sage-1,代码行数:29,代码来源:arrow.py
示例7: _plot3d_options
def _plot3d_options(self, options=None):
"""
Translate 2D plot options into 3D plot options.
EXAMPLES::
sage: P = arrow((0,1), (2,3), width=5)
sage: p=P[0]; p
Arrow from (0.0,1.0) to (2.0,3.0)
sage: q=p.plot3d()
sage: q.thickness
5
"""
if options is None:
options = self.options()
options = dict(self.options())
options_3d = {}
if "width" in options:
options_3d["thickness"] = options["width"]
del options["width"]
# ignore zorder and head in 3d plotting
if "zorder" in options:
del options["zorder"]
if "head" in options:
del options["head"]
if "linestyle" in options:
del options["linestyle"]
options_3d.update(GraphicPrimitive._plot3d_options(self, options))
return options_3d
开发者ID:nvcleemp,项目名称:sage,代码行数:29,代码来源:arrow.py
示例8: _plot3d_options
def _plot3d_options(self, options=None):
"""
Translate 2D plot options into 3D plot options.
EXAMPLES::
sage: T = text("ABC",(1,1))
sage: t = T[0]
sage: t.options()['rgbcolor']
(0.0, 0.0, 1.0)
sage: s=t.plot3d()
sage: s.jmol_repr(s.testing_render_params())[0][1]
'color atom [0,0,255]'
"""
if options is None:
options = dict(self.options())
options_3d = {}
# TODO: figure out how to implement rather than ignore
for s in ['axis_coords', 'clip', 'fontsize', 'horizontal_alignment',
'rotation', 'vertical_alignment']:
if s in options:
del options[s]
options_3d.update(GraphicPrimitive._plot3d_options(self, options))
return options_3d
开发者ID:drupel,项目名称:sage,代码行数:25,代码来源:text.py
示例9: __init__
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,代码行数:18,代码来源:histogram.py
示例10: __init__
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,代码行数:19,代码来源:density_plot.py
示例11: __init__
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,代码行数:19,代码来源:text.py
示例12: __init__
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,代码行数:42,代码来源:arc.py
示例13: __init__
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,代码行数:38,代码来源:streamline_plot.py
示例14: __init__
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,代码行数:24,代码来源:matrix_plot.py
注:本文中的sage.plot.primitive.GraphicPrimitive类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论