Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c17fb8c

Browse files
committed
Merge pull request #3668 from thisch/pep8fix26
[examples] pep8 fix E26*
2 parents 0790137 + 4a659b3 commit c17fb8c

File tree

92 files changed

+234
-231
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+234
-231
lines changed

examples/event_handling/path_editor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def __init__(self, pathpatch):
5151

5252
self.line, = ax.plot(x,y,marker='o', markerfacecolor='r', animated=True)
5353

54-
self._ind = None # the active vert
54+
self._ind = None # the active vert
5555

5656
canvas.mpl_connect('draw_event', self.draw_callback)
5757
canvas.mpl_connect('button_press_event', self.button_press_callback)

examples/event_handling/pick_event_demo.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def pick_handler(event):
7373
import numpy as np
7474
from numpy.random import rand
7575

76-
if 1: # simple picking, lines, rectangles and text
76+
if 1: # simple picking, lines, rectangles and text
7777
fig, (ax1, ax2) = plt.subplots(2,1)
7878
ax1.set_title('click on points, rectangles or text', picker=True)
7979
ax1.set_ylabel('ylabel', picker=True, bbox=dict(facecolor='red'))
@@ -100,7 +100,7 @@ def onpick1(event):
100100

101101
fig.canvas.mpl_connect('pick_event', onpick1)
102102

103-
if 1: # picking with a custom hit test function
103+
if 1: # picking with a custom hit test function
104104
# you can define custom pickers by setting picker to a callable
105105
# function. The function has the signature
106106
#
@@ -140,7 +140,7 @@ def onpick2(event):
140140
fig.canvas.mpl_connect('pick_event', onpick2)
141141

142142

143-
if 1: # picking on a scatter plot (matplotlib.collections.RegularPolyCollection)
143+
if 1: # picking on a scatter plot (matplotlib.collections.RegularPolyCollection)
144144

145145
x, y, c, s = rand(4, 100)
146146

@@ -153,7 +153,7 @@ def onpick3(event):
153153
#fig.savefig('pscoll.eps')
154154
fig.canvas.mpl_connect('pick_event', onpick3)
155155

156-
if 1: # picking images (matplotlib.image.AxesImage)
156+
if 1: # picking images (matplotlib.image.AxesImage)
157157
fig, ax = plt.subplots()
158158
im1 = ax.imshow(rand(10,5), extent=(1,2,1,2), picker=True)
159159
im2 = ax.imshow(rand(5,10), extent=(3,4,1,2), picker=True)

examples/event_handling/pipong.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,14 @@ def update(self,pads):
7979
self.vx *= 1.2 *pad.signx
8080
self.vy *= 1.2 *pad.signy
8181
fudge = .001
82-
#probably cleaner with something like...if not self.field.contains(self.x, self.y):
82+
# probably cleaner with something like...if not self.field.contains(self.x, self.y):
8383
if self.x < 0+fudge:
84-
#print "player A loses"
84+
#print("player A loses")
8585
pads[1].score += 1;
8686
self._reset(pads[0])
8787
return True
8888
if self.x > 7-fudge:
89-
#print "player B loses"
89+
#print("player B loses")
9090
pads[0].score += 1;
9191
self._reset(pads[1])
9292
return True

examples/event_handling/poly_editor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def __init__(self, ax, poly):
4141
#self._update_line(poly)
4242

4343
cid = self.poly.add_callback(self.poly_changed)
44-
self._ind = None # the active vert
44+
self._ind = None # the active vert
4545

4646
canvas.mpl_connect('draw_event', self.draw_callback)
4747
canvas.mpl_connect('button_press_event', self.button_press_callback)
@@ -106,7 +106,7 @@ def key_press_callback(self, event):
106106
self.line.set_data(zip(*self.poly.xy))
107107
elif event.key=='i':
108108
xys = self.poly.get_transform().transform(self.poly.xy)
109-
p = event.x, event.y # display coords
109+
p = event.x, event.y # display coords
110110
for i in range(len(xys)-1):
111111
s0 = xys[i]
112112
s1 = xys[i+1]

examples/event_handling/pong_gtk.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ def start_anim(event):
3030

3131

3232
tstart = time.time()
33-
plt.grid() # to ensure proper background restore
33+
plt.grid() # to ensure proper background restore
3434
plt.show()
3535
print('FPS:' , animation.cnt/(time.time()-tstart))

examples/event_handling/resample.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ def update(self, ax):
4242

4343
fig, ax = plt.subplots()
4444

45-
#Hook up the line
45+
# Hook up the line
4646
xdata, ydata = d.downsample(xdata[0], xdata[-1])
4747
d.line, = ax.plot(xdata, ydata)
48-
ax.set_autoscale_on(False) # Otherwise, infinite loop
48+
ax.set_autoscale_on(False) # Otherwise, infinite loop
4949

5050
# Connect for changing the view limits
5151
ax.callbacks.connect('xlim_changed', d.update)

examples/event_handling/viewlims.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ def __call__(self, xstart, xend, ystart, yend):
3939
return threshold_time
4040

4141
def ax_update(self, ax):
42-
ax.set_autoscale_on(False) # Otherwise, infinite loop
42+
ax.set_autoscale_on(False) # Otherwise, infinite loop
4343

44-
#Get the number of points from the number of pixels in the window
44+
# Get the number of points from the number of pixels in the window
4545
dims = ax.axesPatch.get_window_extent().bounds
4646
self.width = int(dims[2] + 0.5)
4747
self.height = int(dims[2] + 0.5)
4848

49-
#Get the range for the new area
49+
# Get the range for the new area
5050
xstart,ystart,xdelta,ydelta = ax.viewLim.bounds
5151
xend = xstart + xdelta
5252
yend = ystart + ydelta

examples/images_contours_and_fields/image_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
image = plt.imread(image_file)
99

1010
plt.imshow(image)
11-
plt.axis('off') # clear x- and y-axes
11+
plt.axis('off') # clear x- and y-axes
1212
plt.show()

examples/images_contours_and_fields/interpolation_none_vs_nearest.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
import matplotlib.pyplot as plt
1616
import matplotlib.cbook as cbook
1717

18-
#Load big image
18+
# Load big image
1919
big_im_path = cbook.get_sample_data('necked_tensile_specimen.png')
2020
big_im = plt.imread(big_im_path)
21-
#Define small image
21+
# Define small image
2222
small_im = np.array([[0.25, 0.75, 1.0, 0.75], [0.1, 0.65, 0.5, 0.4], \
2323
[0.6, 0.3, 0.0, 0.2], [0.7, 0.9, 0.4, 0.6]])
2424

25-
#Create a 2x2 table of plots
25+
# Create a 2x2 table of plots
2626
fig = plt.figure(figsize=[8.0, 7.5])
2727
ax = plt.subplot(2,2,1)
2828
ax.imshow(big_im, interpolation='none')
@@ -35,25 +35,25 @@
3535
plt.subplots_adjust(left=0.24, wspace=0.2, hspace=0.1, \
3636
bottom=0.05, top=0.86)
3737

38-
#Label the rows and columns of the table
38+
# Label the rows and columns of the table
3939
fig.text(0.03, 0.645, 'Big Image\nScaled Down', ha='left')
4040
fig.text(0.03, 0.225, 'Small Image\nBlown Up', ha='left')
4141
fig.text(0.383, 0.90, "Interpolation = 'none'", ha='center')
4242
fig.text(0.75, 0.90, "Interpolation = 'nearest'", ha='center')
4343

44-
#If you were going to run this example on your local machine, you
45-
#would save the figure as a PNG, save the same figure as a PDF, and
46-
#then compare them. The following code would suffice.
44+
# If you were going to run this example on your local machine, you
45+
# would save the figure as a PNG, save the same figure as a PDF, and
46+
# then compare them. The following code would suffice.
4747
txt = fig.text(0.452, 0.95, 'Saved as a PNG', fontsize=18)
4848
# plt.savefig('None_vs_nearest-png.png')
4949
# txt.set_text('Saved as a PDF')
5050
# plt.savefig('None_vs_nearest-pdf.pdf')
5151

52-
#Here, however, we need to display the PDF on a webpage, which means
53-
#the PDF must be converted into an image. For the purposes of this
54-
#example, the 'Nearest_vs_none-pdf.pdf' has been pre-converted into
52+
# Here, however, we need to display the PDF on a webpage, which means
53+
# the PDF must be converted into an image. For the purposes of this
54+
# example, the 'Nearest_vs_none-pdf.pdf' has been pre-converted into
5555
#'Nearest_vs_none-pdf.png' at 80 dpi. We simply need to load and
56-
#display it.
56+
# display it.
5757
pdf_im_path = cbook.get_sample_data('None_vs_nearest-pdf.png')
5858
pdf_im = plt.imread(pdf_im_path)
5959
fig2 = plt.figure(figsize=[8.0, 7.5])

examples/lines_bars_and_markers/line_demo_dash_control.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
x = np.linspace(0, 10)
1212
line, = plt.plot(x, np.sin(x), '--', linewidth=2)
1313

14-
dashes = [10, 5, 100, 5] # 10 points on, 5 off, 100 on, 5 off
14+
dashes = [10, 5, 100, 5] # 10 points on, 5 off, 100 on, 5 off
1515
line.set_dashes(dashes)
1616

1717
plt.show()

0 commit comments

Comments
 (0)