Skip to content

Commit a623ff3

Browse files
committed
more subplots, cleanup of old import * style
1 parent d42109a commit a623ff3

37 files changed

+85
-102
lines changed

examples/animation/old_animation/animation_blit_qt.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from __future__ import print_function
55

6-
import os, sys
6+
import sys
77
import matplotlib
88
matplotlib.use('QtAgg') # qt3 example
99

@@ -16,21 +16,21 @@
1616
FALSE = 0
1717
ITERS = 1000
1818

19-
import pylab as p
19+
import matplotlib.pyplot as plt
2020
import numpy as npy
2121
import time
2222

2323
class BlitQT(QObject):
2424
def __init__(self):
2525
QObject.__init__(self, None, "app")
2626

27-
fig, self.ax = plt.subplots()
27+
self.ax = plt.axes()
2828
self.canvas = self.ax.figure.canvas
2929
self.cnt = 0
3030

3131
# create the initial line
3232
self.x = npy.arange(0,2*npy.pi,0.01)
33-
self.line, = p.plot(self.x, npy.sin(self.x), animated=True, lw=2)
33+
self.line, = plt.plot(self.x, npy.sin(self.x), animated=True, lw=2)
3434

3535
self.background = None
3636

@@ -55,12 +55,12 @@ def timerEvent(self, evt):
5555
else:
5656
self.cnt += 1
5757

58-
p.subplots_adjust(left=0.3, bottom=0.3) # check for flipy bugs
59-
p.grid() # to ensure proper background restore
58+
plt.subplots_adjust(left=0.3, bottom=0.3) # check for flipy bugs
59+
plt.grid() # to ensure proper background restore
6060

6161
app = BlitQT()
6262
# for profiling
6363
app.tstart = time.time()
6464
app.startTimer(0)
6565

66-
p.show()
66+
plt.show()

examples/animation/old_animation/animation_blit_tk.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import time
1313

1414
fig, ax = plt.subplots()
15-
canvas = ax.figure.canvas
15+
canvas = fig.canvas
1616

1717

1818
# create the initial line

examples/animation/old_animation/animation_blit_wx.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import matplotlib
1111
matplotlib.use('WXAgg')
1212
matplotlib.rcParams['toolbar'] = 'None'
13+
import matplotlib.pyplot as plt
1314

1415
import wx
1516
import sys

examples/animation/old_animation/histogram_tkagg.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
This example shows how to use a path patch to draw a bunch of
33
rectangles for an animated histogram
44
"""
5-
import time
65
import numpy as np
76
import matplotlib
87
matplotlib.use('TkAgg') # do this before importing pylab

examples/animation/old_animation/simple_idle_wx.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
A simple example of an animated plot using a wx backend
33
"""
44
from __future__ import print_function
5-
import time
65
import numpy as np
76
import matplotlib
87
matplotlib.use('WXAgg') # do this before importing pylab

examples/animation/old_animation/simple_timer_wx.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"""
33
A simple example of an animated plot using a wx backend
44
"""
5-
import time
65
import numpy as np
76
import matplotlib
87
matplotlib.use('WXAgg') # do this before importing pylab

examples/animation/old_animation/strip_chart_demo.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import matplotlib
1414
matplotlib.use('GTKAgg')
1515
import numpy as np
16+
import matplotlib.pyplot as plt
1617
from matplotlib.lines import Line2D
1718

1819

@@ -62,10 +63,8 @@ def update(self, *args):
6263
return True
6364

6465

65-
from pylab import figure, show
66-
6766
fig, ax = plt.subplots()
6867
scope = Scope(ax)
6968
gobject.idle_add(scope.update)
7069

71-
show()
70+
plt.show()

examples/animation/strip_chart_demo.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
Emulate an oscilloscope. Requires the animation API introduced in
33
matplotlib 1.0 SVN.
44
"""
5-
import matplotlib
65
import numpy as np
76
from matplotlib.lines import Line2D
87
import matplotlib.pyplot as plt

examples/api/joinstyle.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"""
55

66
import numpy as np
7-
import matplotlib
87
import matplotlib.pyplot as plt
98

109
def plot_angle(ax, x, y, angle, style):

examples/api/path_patch_demo.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import numpy as np
21
import matplotlib.path as mpath
32
import matplotlib.patches as mpatches
43
import matplotlib.pyplot as plt

0 commit comments

Comments
 (0)