|
From: <ry...@us...> - 2010-08-26 03:30:44
|
Revision: 8661
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8661&view=rev
Author: ryanmay
Date: 2010-08-26 03:30:38 +0000 (Thu, 26 Aug 2010)
Log Message:
-----------
Update examples to use proper imports.
Modified Paths:
--------------
trunk/matplotlib/examples/animation/animate_decay.py
trunk/matplotlib/examples/animation/dynamic_image.py
trunk/matplotlib/examples/animation/dynamic_image2.py
trunk/matplotlib/examples/animation/histogram.py
trunk/matplotlib/examples/animation/random_data.py
trunk/matplotlib/examples/animation/simple_3danim.py
trunk/matplotlib/examples/animation/simple_anim.py
trunk/matplotlib/examples/animation/strip_chart_demo.py
trunk/matplotlib/examples/animation/subplots.py
Modified: trunk/matplotlib/examples/animation/animate_decay.py
===================================================================
--- trunk/matplotlib/examples/animation/animate_decay.py 2010-08-26 03:23:25 UTC (rev 8660)
+++ trunk/matplotlib/examples/animation/animate_decay.py 2010-08-26 03:30:38 UTC (rev 8661)
@@ -1,6 +1,6 @@
import numpy as np
import matplotlib.pyplot as plt
-from animation import FuncAnimation
+import matplotlib.animation as animation
def data_gen():
t = data_gen.t
@@ -32,5 +32,6 @@
return line,
-ani = FuncAnimation(fig, run, data_gen, blit=True, interval=10, repeat=False)
+ani = animation.FuncAnimation(fig, run, data_gen, blit=True, interval=10,
+ repeat=False)
plt.show()
Modified: trunk/matplotlib/examples/animation/dynamic_image.py
===================================================================
--- trunk/matplotlib/examples/animation/dynamic_image.py 2010-08-26 03:23:25 UTC (rev 8660)
+++ trunk/matplotlib/examples/animation/dynamic_image.py 2010-08-26 03:30:38 UTC (rev 8661)
@@ -4,7 +4,7 @@
"""
import numpy as np
import matplotlib.pyplot as plt
-from animation import FuncAnimation
+import matplotlib.animation as animation
fig = plt.figure()
@@ -23,5 +23,5 @@
im.set_array(f(x,y))
return im,
-ani = FuncAnimation(fig, updatefig, interval=50, blit=True)
+ani = animation.FuncAnimation(fig, updatefig, interval=50, blit=True)
plt.show()
Modified: trunk/matplotlib/examples/animation/dynamic_image2.py
===================================================================
--- trunk/matplotlib/examples/animation/dynamic_image2.py 2010-08-26 03:23:25 UTC (rev 8660)
+++ trunk/matplotlib/examples/animation/dynamic_image2.py 2010-08-26 03:30:38 UTC (rev 8661)
@@ -4,7 +4,7 @@
"""
import numpy as np
import matplotlib.pyplot as plt
-from animation import ArtistAnimation
+import matplotlib.animation as animation
fig = plt.figure()
@@ -20,5 +20,6 @@
y += np.pi / 20.
ims.append([plt.imshow(f(x, y), cmap=plt.get_cmap('jet'))])
-ani = ArtistAnimation(fig, ims, interval=50, blit=True, repeat_delay=1000)
+ani = animation.ArtistAnimation(fig, ims, interval=50, blit=True,
+ repeat_delay=1000)
plt.show()
Modified: trunk/matplotlib/examples/animation/histogram.py
===================================================================
--- trunk/matplotlib/examples/animation/histogram.py 2010-08-26 03:23:25 UTC (rev 8660)
+++ trunk/matplotlib/examples/animation/histogram.py 2010-08-26 03:30:38 UTC (rev 8661)
@@ -7,7 +7,7 @@
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import matplotlib.path as path
-from animation import FuncAnimation
+import matplotlib.animation as animation
fig = plt.figure()
ax = fig.add_subplot(111)
@@ -58,5 +58,5 @@
verts[1::5,1] = top
verts[2::5,1] = top
-ani = FuncAnimation(fig, animate, 100, repeat=False)
+ani = animation.FuncAnimation(fig, animate, 100, repeat=False)
plt.show()
Modified: trunk/matplotlib/examples/animation/random_data.py
===================================================================
--- trunk/matplotlib/examples/animation/random_data.py 2010-08-26 03:23:25 UTC (rev 8660)
+++ trunk/matplotlib/examples/animation/random_data.py 2010-08-26 03:30:38 UTC (rev 8661)
@@ -1,6 +1,6 @@
import numpy as np
import matplotlib.pyplot as plt
-from animation import FuncAnimation
+import matplotlib.animation as animation
fig = plt.figure()
ax = fig.add_subplot(111)
@@ -14,5 +14,5 @@
def data_gen():
while True: yield np.random.rand(10)
-ani = FuncAnimation(fig, update, data_gen, interval=100)
+ani = animation.FuncAnimation(fig, update, data_gen, interval=100)
plt.show()
Modified: trunk/matplotlib/examples/animation/simple_3danim.py
===================================================================
--- trunk/matplotlib/examples/animation/simple_3danim.py 2010-08-26 03:23:25 UTC (rev 8660)
+++ trunk/matplotlib/examples/animation/simple_3danim.py 2010-08-26 03:30:38 UTC (rev 8661)
@@ -4,9 +4,8 @@
import numpy as np
import matplotlib.pyplot as plt
import mpl_toolkits.mplot3d.axes3d as p3
+import matplotlib.animation as animation
-from animation import FuncAnimation
-
def Gen_RandLine(length, dims=2) :
"""
Create a line using a random walk algorithm
@@ -57,7 +56,7 @@
ax.set_title('3D Test')
# Creating the Animation object
-line_ani = FuncAnimation(fig, update_lines, 25, fargs=(data, lines),
+line_ani = animation.FuncAnimation(fig, update_lines, 25, fargs=(data, lines),
interval=50, blit=False)
plt.show()
Modified: trunk/matplotlib/examples/animation/simple_anim.py
===================================================================
--- trunk/matplotlib/examples/animation/simple_anim.py 2010-08-26 03:23:25 UTC (rev 8660)
+++ trunk/matplotlib/examples/animation/simple_anim.py 2010-08-26 03:30:38 UTC (rev 8661)
@@ -3,7 +3,7 @@
"""
import numpy as np
import matplotlib.pyplot as plt
-from animation import FuncAnimation
+import matplotlib.animation as animation
fig = plt.figure()
ax = fig.add_subplot(111)
@@ -20,6 +20,6 @@
line.set_ydata(np.ma.array(x, mask=True))
return line,
-ani = FuncAnimation(fig, animate, np.arange(1, 200), init_func=init,
+ani = animation.FuncAnimation(fig, animate, np.arange(1, 200), init_func=init,
interval=25, blit=True)
plt.show()
Modified: trunk/matplotlib/examples/animation/strip_chart_demo.py
===================================================================
--- trunk/matplotlib/examples/animation/strip_chart_demo.py 2010-08-26 03:23:25 UTC (rev 8660)
+++ trunk/matplotlib/examples/animation/strip_chart_demo.py 2010-08-26 03:30:38 UTC (rev 8661)
@@ -6,7 +6,7 @@
import numpy as np
from matplotlib.lines import Line2D
import matplotlib.pyplot as plt
-from animation import FuncAnimation
+import matplotlib.animation as animation
class Scope:
def __init__(self, ax, maxt=10, dt=0.01):
@@ -45,5 +45,6 @@
fig = plt.figure()
ax = fig.add_subplot(111)
scope = Scope(ax)
-ani = FuncAnimation(fig, scope.update, emitter, interval=10, blit=True)
+ani = animation.FuncAnimation(fig, scope.update, emitter, interval=10,
+ blit=True)
plt.show()
Modified: trunk/matplotlib/examples/animation/subplots.py
===================================================================
--- trunk/matplotlib/examples/animation/subplots.py 2010-08-26 03:23:25 UTC (rev 8660)
+++ trunk/matplotlib/examples/animation/subplots.py 2010-08-26 03:30:38 UTC (rev 8661)
@@ -1,14 +1,14 @@
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D
-from animation import TimedAnimation
+import matplotlib.animation as animation
# This example uses subclassing, but there is no reason that the proper function
# couldn't be set up and then use FuncAnimation. The code is long, but not
# really complex. The length is due solely to the fact that there are a total
# of 9 lines that need to be changed for the animation as well as 3 subplots
# that need initial set up.
-class SubplotAnimation(TimedAnimation):
+class SubplotAnimation(animation.TimedAnimation):
def __init__(self):
fig = plt.figure()
ax1 = fig.add_subplot(1, 2, 1)
@@ -54,7 +54,7 @@
ax3.set_xlim(-1, 1)
ax3.set_ylim(0, 800)
- TimedAnimation.__init__(self, fig, interval=50, blit=True)
+ animation.TimedAnimation.__init__(self, fig, interval=50, blit=True)
def _draw_frame(self, framedata):
i = framedata
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|