Skip to content

Commit 1e81fe0

Browse files
committed
Merge pull request matplotlib#3513 from thisch/examples_whitespace_fixes
PEP8 : fix blank-line violations in examples
2 parents db5fbff + 4f0a481 commit 1e81fe0

File tree

177 files changed

+220
-316
lines changed

Some content is hidden

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

177 files changed

+220
-316
lines changed

examples/color/color_cycle_demo.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,3 @@
3030
# Tweak spacing between subplots to prevent labels from overlapping
3131
plt.subplots_adjust(hspace=0.3)
3232
plt.show()
33-
34-

examples/color/colormaps_reference.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
gradient = np.linspace(0, 1, 256)
6060
gradient = np.vstack((gradient, gradient))
6161

62+
6263
def plot_color_gradients(cmap_category, cmap_list):
6364
fig, axes = plt.subplots(nrows=nrows)
6465
fig.subplots_adjust(top=0.95, bottom=0.01, left=0.2, right=0.99)

examples/event_handling/close_event.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import print_function
22
import matplotlib.pyplot as plt
33

4+
45
def handle_close(evt):
56
print('Closed Figure!')
67

examples/event_handling/data_browser.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class PointBrowser:
77
generated the point will be shown in the lower axes. Use the 'n'
88
and 'p' keys to browse through the next and previous points
99
"""
10+
1011
def __init__(self):
1112
self.lastind = 0
1213

@@ -21,7 +22,6 @@ def onpress(self, event):
2122
if event.key=='n': inc = 1
2223
else: inc = -1
2324

24-
2525
self.lastind += inc
2626
self.lastind = np.clip(self.lastind, 0, len(xs)-1)
2727
self.update()
@@ -37,7 +37,6 @@ def onpick(self, event):
3737
x = event.mouseevent.xdata
3838
y = event.mouseevent.ydata
3939

40-
4140
distances = np.hypot(x-xs[event.ind], y-ys[event.ind])
4241
indmin = distances.argmin()
4342
dataind = event.ind[indmin]
@@ -80,4 +79,3 @@ def update(self):
8079
fig.canvas.mpl_connect('key_press_event', browser.onpress)
8180

8281
plt.show()
83-

examples/event_handling/figure_axes_enter_leave.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,25 @@
55
from __future__ import print_function
66
import matplotlib.pyplot as plt
77

8+
89
def enter_axes(event):
910
print('enter_axes', event.inaxes)
1011
event.inaxes.patch.set_facecolor('yellow')
1112
event.canvas.draw()
1213

14+
1315
def leave_axes(event):
1416
print('leave_axes', event.inaxes)
1517
event.inaxes.patch.set_facecolor('white')
1618
event.canvas.draw()
1719

20+
1821
def enter_figure(event):
1922
print('enter_figure', event.canvas.figure)
2023
event.canvas.figure.patch.set_facecolor('red')
2124
event.canvas.draw()
2225

26+
2327
def leave_figure(event):
2428
print('leave_figure', event.canvas.figure)
2529
event.canvas.figure.patch.set_facecolor('grey')
@@ -42,5 +46,3 @@ def leave_figure(event):
4246
fig2.canvas.mpl_connect('axes_leave_event', leave_axes)
4347

4448
plt.show()
45-
46-

examples/event_handling/idle_and_timeout.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
line2, = ax.plot(y2)
1717

1818
N = 100
19+
20+
1921
def on_idle(event):
2022
on_idle.count +=1
2123
print('idle', on_idle.count)
@@ -31,5 +33,3 @@ def on_idle(event):
3133
fig.canvas.mpl_connect('idle_event', on_idle)
3234

3335
plt.show()
34-
35-

examples/event_handling/lasso_demo.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@
1515
from numpy import nonzero
1616
from numpy.random import rand
1717

18+
1819
class Datum(object):
1920
colorin = colorConverter.to_rgba('red')
2021
colorout = colorConverter.to_rgba('blue')
22+
2123
def __init__(self, x, y, include=False):
2224
self.x = x
2325
self.y = y

examples/event_handling/looking_glass.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
ax.plot(x, y, alpha=0.2)
1212
line, = ax.plot(x, y, alpha=1.0, clip_path=circ)
1313

14+
1415
class EventHandler:
1516
def __init__(self):
1617
fig.canvas.mpl_connect('button_press_event', self.onpress)

examples/event_handling/path_editor.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ def __init__(self, pathpatch):
6060
canvas.mpl_connect('motion_notify_event', self.motion_notify_callback)
6161
self.canvas = canvas
6262

63-
6463
def draw_callback(self, event):
6564
self.background = self.canvas.copy_from_bbox(self.ax.bbox)
6665
self.ax.draw_artist(self.pathpatch)
@@ -74,7 +73,6 @@ def pathpatch_changed(self, pathpatch):
7473
plt.Artist.update_from(self.line, pathpatch)
7574
self.line.set_visible(vis) # don't use the pathpatch visibility state
7675

77-
7876
def get_ind_under_point(self, event):
7977
'get the index of the vertex under point if within epsilon tolerance'
8078

@@ -138,5 +136,3 @@ def motion_notify_callback(self, event):
138136
ax.set_ylim(-3,4)
139137

140138
plt.show()
141-
142-

examples/event_handling/pick_event_demo.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ def pick_handler(event):
8484
for label in ax2.get_xticklabels(): # make the xtick labels pickable
8585
label.set_picker(True)
8686

87-
8887
def onpick1(event):
8988
if isinstance(event.artist, Line2D):
9089
thisline = event.artist
@@ -99,8 +98,6 @@ def onpick1(event):
9998
text = event.artist
10099
print('onpick1 text:', text.get_text())
101100

102-
103-
104101
fig.canvas.mpl_connect('pick_event', onpick1)
105102

106103
if 1: # picking with a custom hit test function
@@ -146,6 +143,7 @@ def onpick2(event):
146143
if 1: # picking on a scatter plot (matplotlib.collections.RegularPolyCollection)
147144

148145
x, y, c, s = rand(4, 100)
146+
149147
def onpick3(event):
150148
ind = event.ind
151149
print('onpick3 scatter:', ind, np.take(x, ind), np.take(y, ind))
@@ -174,4 +172,3 @@ def onpick4(event):
174172

175173

176174
plt.show()
177-

0 commit comments

Comments
 (0)