| Home | Trees | Indices | Help |
|---|
|
|
object --+
|
structure.sage_object.SageObject --+
|
Animation
Return an animation of a sequence of plots of objects.
INPUT:
v -- list of SAGE objects. These should preferably be graphics objects,
but if they aren't then plot is called on them.
xmin, xmax, ymin, ymax -- the ranges of the x and y axis.
**kwds -- all additional inputs are passed onto the rendering
command. E.g., use figsize to adjust the resolution and
aspect ratio.
EXAMPLES:
sage: a = animate([sin(x + float(k)) for k in srange(0,4,0.3)],
... xmin=0, xmax=2*pi, figsize=[2,1]) # optional -- requires convert command
sage: a # optional
Animation with 14 frames
sage: a[:5] # optional
Animation with 5 frames
sage: a.show() # optional
sage: a[:5].show() # optional
We draw an animation of drawing a parabola:
sage: step = 0.1
sage: L = Graphics()
sage: v = []
sage: for i in srange(0,1,step):
... L += line([(i,i^2),(i+step,(i+step)^2)], rgbcolor=(1,0,0), thickness=2)
... v.append(L)
...
sage: a = animate(v, xmin=0, ymin=0)
sage: a.show()
sage: show(L)
TESTS:
This illustrates ticket \#2066 is fixed (setting axes ranges when an endpoint is 0):
sage: animate(plot(sin, -1,1), xmin=0, ymin=0)._Animation__xmin
0
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Inherited from Inherited from |
|||
|
|||
|
Inherited from |
|||
|
|||
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
|
Get a frame from an animation.
EXAMPLES:
sage: a = animate([x, x^2, x^3, x^4]) # optional -- requires convert command
sage: a[2].show() # optional
|
Slice this animation returning a subanimation.
EXAMPLES:
sage: a = animate([circle((i,-i), 1-1/(i+1), hue=i/10) for i in srange(0,2,0.2)],
... xmin=0,ymin=-2,xmax=2,ymax=0,figsize=[2,2]) # optional -- requires convert command
...
sage: a # optional
Animation with 10 frames
sage: a.show() # optional
sage: a[3:7] # optional
Animation with 4 frames
sage: a[3:7].show() # optional
|
Add two animations. This has the effect of
superimposing the two animinations frame-by-frame.
EXAMPLES:
We add and multiply two animations.
sage: a = animate([circle((i,0),1) for i in srange(0,2,0.4)],
... xmin=0, ymin=-1, xmax=3, ymax=1, figsize=[2,1]) # optional -- requires convert command
sage: a.show() # optional
sage: b = animate([circle((0,i),1,hue=0) for i in srange(0,2,0.4)],
... xmin=0, ymin=-1, xmax=1, ymax=3, figsize=[1,2]) # optional
sage: b.show() # optional
sage: (a*b).show() # optional
sage: (a+b).show() # optional
|
Multiply two animations. This has the effect of
appending the two animinations (the second comes
after the first).
EXAMPLES:
We add and multiply two animations.
sage: a = animate([circle((i,0),1,thickness=20*i) for i in srange(0,2,0.4)],
... xmin=0, ymin=-1, xmax=3, ymax=1, figsize=[2,1], axes=False) # optional -- requires convert command
sage: a.show() # optional
sage: b = animate([circle((0,i),1,hue=0,thickness=20*i) for i in srange(0,2,0.4)],
... xmin=0, ymin=-1, xmax=1, ymax=3, figsize=[1,2], axes=False) # optional
sage: b.show() # optional
sage: (a*b).show() # optional
sage: (a+b).show() # optional
|
Return the absolute path to a temp directory that contains the rendered
png's of all the images in this animation.
EXAMPLES:
sage: a = animate([plot(x^2 + n) for n in range(4)]) # optional -- requires convert command
sage: d = a.png() # optional -- directory where the files are
sage: v = os.listdir(d); v.sort(); v # optional
['00000000.png', '00000001.png', '00000002.png', '00000003.png']
|
Return a graphics array with the given number of columns
with plots of the frames of this animation.
EXAMPLES:
sage: E = EllipticCurve('37a')
sage: v = [E.change_ring(GF(p)).plot(pointsize=30) for p in [97, 101, 103, 107]]
sage: a = animate(v, xmin=0, ymin=0) # optional -- requires convert command
sage: a # optional
Animation with 4 frames
sage: a.show() # optional
sage: g = a.graphics_array() # optional
sage: print g # optional
Graphics Array of size 1 x 3
sage: g.show(figsize=[4,1]) # optional
sage: g = a.graphics_array(ncols=2) # optional
sage: print g # optional
Graphics Array of size 2 x 2
sage: g.show('sage.png') # optional
|
Returns an animated gif composed from rendering the
graphics objects in self.
This function will only work if the Imagemagick command line
tools package is installed, i.e., you have the ``\code{convert}'' command.
INPUT:
delay -- (default: 20) delay in hundredths of a second between frames
outfile -- file that the animated gif gets saved to
iterations -- integer (default: 0); number of iterations of
animation. If 0, loop forever.
AUTHOR:
-- William Stein
|
Show this animation. Currently this is done by default using an animated gif, though this could change in the future. |
File: sage/structure/sage_object.pyx (starting at line 130)
Save self to the given filename.
EXAMPLES:
sage: f = x^3 + 5
sage: f.save(SAGE_TMP + '/file')
sage: load(SAGE_TMP + '/file.sobj')
x^3 + 5
|
| Home | Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0beta1 on Thu Jul 17 04:23:49 2008 | http://epydoc.sourceforge.net |