Changeset 5278:122c820a2276
- Timestamp:
- 07/04/07 16:56:19 (6 years ago)
- Branch:
- default
- Location:
- sage/plot
- Files:
-
- 1 added
- 2 edited
-
all.py (modified) (1 diff)
-
animate.py (added)
-
plot.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sage/plot/all.py
r5263 r5278 5 5 plot_vector_field, matrix_plot, bar_chart, 6 6 is_Graphics, 7 show_default, 8 plot_animated_gif) 7 show_default) 8 9 from animate import Animation as animate 9 10 10 11 from plot3d import (Graphics3d, point3d, line3d, plot3d) -
sage/plot/plot.py
r5265 r5278 120 120 """ 121 121 122 #***************************************************************************** 123 # Copyright (C) 2006 Alex Clemesha <clemesha@gmail.com> and William Stein <wstein@ucsd.edu> 124 # 122 ############################################################################ 123 # Copyright (C) 2006 Alex Clemesha <clemesha@gmail.com> and William Stein <wstein@gmail.com> 125 124 # Distributed under the terms of the GNU General Public License (GPL) 126 #127 125 # http://www.gnu.org/licenses/ 128 #***************************************************************************** 129 130 import pdb 126 ############################################################################ 131 127 132 128 from sage.structure.sage_object import SageObject 133 129 134 ## IMPORTANT: Do notimport matplotlib at module scope. It takes a130 ## IMPORTANT: Do *not* import matplotlib at module scope. It takes a 135 131 ## surprisingliy long time to initialize itself. It's better if it is 136 132 ## imported in functions, so it only gets started if it is actually … … 2684 2680 if not isinstance(array, (list, tuple)): 2685 2681 raise TypeError,"array (=%s) must be a list of lists of Graphics objects"%(array) 2682 array = list(array) 2686 2683 self._glist = [] 2687 2684 self._rows = len(array) … … 2913 2910 return R 2914 2911 2915 2916 2917 #####################################2918 def plot_animated_gif(G, delay=20, outfile=None, iterations=0,2919 xmin=None, xmax=None, ymin=None, ymax=None, *args, **kwds):2920 """2921 Returns an animated gif composed from rendering the2922 graphics objects in the list G.2923 2924 This function will only work if the Imagemagick command line tools2925 package is installed, i.e., you have the"convert" command.2926 2927 INPUT:2928 G -- a list of plot objects2929 delay -- (default: 20) delay in hundredths of a second between frames2930 outfile -- file that the animated gif gets saved to2931 iterations -- integer (default: 0); number of iterations of2932 animation. If 0, loop forever.2933 other options -- all are passed to the save command,2934 which is called on each input.2935 2936 AUTHOR:2937 -- William Stein2938 """2939 if not outfile:2940 outfile = sage.misc.misc.graphics_filename(ext='gif')2941 if len(G) == 0:2942 raise ValueError, "G must be nonempty"2943 d = sage.misc.misc.tmp_dir()2944 if xmin is None: xmin = G[0].xmin()2945 if xmax is None: xmax = G[0].xmax()2946 if ymin is None: ymin = G[0].ymin()2947 if ymax is None: ymax = G[0].ymax()2948 for i in range(len(G)):2949 filename = '%s/%s'%(d,sage.misc.misc.pad_zeros(i,8))2950 G[i].save(filename + '.png', xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, *args, **kwds)2951 if not outfile.endswith('.gif'):2952 outfile += '.gif'2953 outfile = os.path.abspath(outfile)2954 cmd = 'cd "%s"; convert -delay %s -loop %s *.png "%s"'%(d, int(delay), int(iterations), outfile)2955 os.system(cmd)2956
Note: See TracChangeset
for help on using the changeset viewer.
