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

Skip to content

Commit 903db2c

Browse files
committed
[examples] fix e241 where it makes sense
Signed-off-by: Thomas Hisch <[email protected]>
1 parent 9b4b97b commit 903db2c

22 files changed

+60
-60
lines changed

examples/color/named_colors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
xf_line = w * (col + 0.25)
6161
xi_text = w * (col + 0.3)
6262

63-
ax.text(xi_text, y, name, fontsize=(h * 0.8),
63+
ax.text(xi_text, y, name, fontsize=(h * 0.8),
6464
horizontalalignment='left',
6565
verticalalignment='center')
6666

examples/event_handling/data_browser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ def __init__(self):
1313

1414
self.text = ax.text(0.05, 0.95, 'selected: none',
1515
transform=ax.transAxes, va='top')
16-
self.selected, = ax.plot([xs[0]], [ys[0]], 'o', ms=12, alpha=0.4,
16+
self.selected, = ax.plot([xs[0]], [ys[0]], 'o', ms=12, alpha=0.4,
1717
color='yellow', visible=False)
1818

1919
def onpress(self, event):
2020
if self.lastind is None: return
2121
if event.key not in ('n', 'p'): return
2222
if event.key=='n': inc = 1
23-
else: inc = -1
23+
else: inc = -1
2424

2525
self.lastind += inc
2626
self.lastind = np.clip(self.lastind, 0, len(xs)-1)

examples/event_handling/pipong.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def __init__(self, ax):
133133
self.line2, = self.ax.plot(self.x, np.cos(self.x), "g", animated=True, lw=4)
134134
self.line3, = self.ax.plot(self.x, np.cos(self.x), "g", animated=True, lw=4)
135135
self.line4, = self.ax.plot(self.x, np.cos(self.x), "r", animated=True, lw=4)
136-
self.centerline, = self.ax.plot([3.5, 3.5], [1, -1], 'k', alpha=.5, animated=True, lw=8)
136+
self.centerline, = self.ax.plot([3.5, 3.5], [1, -1], 'k', alpha=.5, animated=True, lw=8)
137137
self.puckdisp = self.ax.scatter([1], [1], label='_nolegend_', s=200, c='g', alpha=.9, animated=True)
138138

139139
self.canvas = self.ax.figure.canvas

examples/misc/rc_traits.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
doprint = True
1414
flexible_true_trait = traits.Trait(
1515
True,
16-
{'true': True, 't': True, 'yes': True, 'y': True, 'on': True, True: True,
17-
'false': False, 'f': False, 'no': False, 'n': False, 'off': False, False: False
16+
{'true': True, 't': True, 'yes': True, 'y': True, 'on': True, True: True,
17+
'false': False, 'f': False, 'no': False, 'n': False, 'off': False, False: False
1818
})
1919
flexible_false_trait = traits.Trait(False, flexible_true_trait)
2020

examples/mplot3d/surface3d_demo2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
x = 10 * np.outer(np.cos(u), np.sin(v))
1212
y = 10 * np.outer(np.sin(u), np.sin(v))
1313
z = 10 * np.outer(np.ones(np.size(u)), np.cos(v))
14-
ax.plot_surface(x, y, z, rstride=4, cstride=4, color='b')
14+
ax.plot_surface(x, y, z, rstride=4, cstride=4, color='b')
1515

1616
plt.show()

examples/pylab_examples/annotation_demo.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,20 @@
5050
s = np.cos(2*np.pi*t)
5151
line, = ax.plot(t, s, lw=3, color='purple')
5252

53-
ax.annotate('axes center', xy=(.5, .5), xycoords='axes fraction',
53+
ax.annotate('axes center', xy=(.5, .5), xycoords='axes fraction',
5454
horizontalalignment='center', verticalalignment='center')
5555

56-
ax.annotate('pixels', xy=(20, 20), xycoords='figure pixels')
56+
ax.annotate('pixels', xy=(20, 20), xycoords='figure pixels')
5757

58-
ax.annotate('points', xy=(100, 300), xycoords='figure points')
58+
ax.annotate('points', xy=(100, 300), xycoords='figure points')
5959

60-
ax.annotate('offset', xy=(1, 1), xycoords='data',
60+
ax.annotate('offset', xy=(1, 1), xycoords='data',
6161
xytext=(-15, 10), textcoords='offset points',
6262
arrowprops=dict(facecolor='black', shrink=0.05),
6363
horizontalalignment='right', verticalalignment='bottom',
6464
)
6565

66-
ax.annotate('local max', xy=(3, 1), xycoords='data',
66+
ax.annotate('local max', xy=(3, 1), xycoords='data',
6767
xytext=(0.8, 0.95), textcoords='axes fraction',
6868
arrowprops=dict(facecolor='black', shrink=0.05),
6969
horizontalalignment='right', verticalalignment='top',

examples/pylab_examples/annotation_demo2.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,65 +11,65 @@
1111
s = np.cos(2*np.pi*t)
1212
line, = ax.plot(t, s, lw=3, color='purple')
1313

14-
ax.annotate('arrowstyle', xy=(0, 1), xycoords='data',
14+
ax.annotate('arrowstyle', xy=(0, 1), xycoords='data',
1515
xytext=(-50, 30), textcoords='offset points',
1616
arrowprops=dict(arrowstyle="->")
1717
)
1818

19-
ax.annotate('arc3', xy=(0.5, -1), xycoords='data',
19+
ax.annotate('arc3', xy=(0.5, -1), xycoords='data',
2020
xytext=(-30, -30), textcoords='offset points',
2121
arrowprops=dict(arrowstyle="->",
2222
connectionstyle="arc3,rad=.2")
2323
)
2424

25-
ax.annotate('arc', xy=(1., 1), xycoords='data',
25+
ax.annotate('arc', xy=(1., 1), xycoords='data',
2626
xytext=(-40, 30), textcoords='offset points',
2727
arrowprops=dict(arrowstyle="->",
2828
connectionstyle="arc,angleA=0,armA=30,rad=10"),
2929
)
3030

31-
ax.annotate('arc', xy=(1.5, -1), xycoords='data',
31+
ax.annotate('arc', xy=(1.5, -1), xycoords='data',
3232
xytext=(-40, -30), textcoords='offset points',
3333
arrowprops=dict(arrowstyle="->",
3434
connectionstyle="arc,angleA=0,armA=20,angleB=-90,armB=15,rad=7"),
3535
)
3636

37-
ax.annotate('angle', xy=(2., 1), xycoords='data',
37+
ax.annotate('angle', xy=(2., 1), xycoords='data',
3838
xytext=(-50, 30), textcoords='offset points',
3939
arrowprops=dict(arrowstyle="->",
4040
connectionstyle="angle,angleA=0,angleB=90,rad=10"),
4141
)
4242

43-
ax.annotate('angle3', xy=(2.5, -1), xycoords='data',
43+
ax.annotate('angle3', xy=(2.5, -1), xycoords='data',
4444
xytext=(-50, -30), textcoords='offset points',
4545
arrowprops=dict(arrowstyle="->",
4646
connectionstyle="angle3,angleA=0,angleB=-90"),
4747
)
4848

49-
ax.annotate('angle', xy=(3., 1), xycoords='data',
49+
ax.annotate('angle', xy=(3., 1), xycoords='data',
5050
xytext=(-50, 30), textcoords='offset points',
5151
bbox=dict(boxstyle="round", fc="0.8"),
5252
arrowprops=dict(arrowstyle="->",
5353
connectionstyle="angle,angleA=0,angleB=90,rad=10"),
5454
)
5555

56-
ax.annotate('angle', xy=(3.5, -1), xycoords='data',
56+
ax.annotate('angle', xy=(3.5, -1), xycoords='data',
5757
xytext=(-70, -60), textcoords='offset points',
5858
size=20,
5959
bbox=dict(boxstyle="round4,pad=.5", fc="0.8"),
6060
arrowprops=dict(arrowstyle="->",
6161
connectionstyle="angle,angleA=0,angleB=-90,rad=10"),
6262
)
6363

64-
ax.annotate('angle', xy=(4., 1), xycoords='data',
64+
ax.annotate('angle', xy=(4., 1), xycoords='data',
6565
xytext=(-50, 30), textcoords='offset points',
6666
bbox=dict(boxstyle="round", fc="0.8"),
6767
arrowprops=dict(arrowstyle="->",
6868
shrinkA=0, shrinkB=10,
6969
connectionstyle="angle,angleA=0,angleB=90,rad=10"),
7070
)
7171

72-
ann = ax.annotate('', xy=(4., 1.), xycoords='data',
72+
ann = ax.annotate('', xy=(4., 1.), xycoords='data',
7373
xytext=(4.5, -1), textcoords='data',
7474
arrowprops=dict(arrowstyle="<->",
7575
connectionstyle="bar",
@@ -87,15 +87,15 @@
8787
el = Ellipse((2, -1), 0.5, 0.5)
8888
ax.add_patch(el)
8989

90-
ax.annotate('$->$', xy=(2., -1), xycoords='data',
90+
ax.annotate('$->$', xy=(2., -1), xycoords='data',
9191
xytext=(-150, -140), textcoords='offset points',
9292
bbox=dict(boxstyle="round", fc="0.8"),
9393
arrowprops=dict(arrowstyle="->",
9494
patchB=el,
9595
connectionstyle="angle,angleA=90,angleB=0,rad=10"),
9696
)
9797

98-
ax.annotate('fancy', xy=(2., -1), xycoords='data',
98+
ax.annotate('fancy', xy=(2., -1), xycoords='data',
9999
xytext=(-100, 60), textcoords='offset points',
100100
size=20,
101101
#bbox=dict(boxstyle="round", fc="0.8"),
@@ -105,7 +105,7 @@
105105
connectionstyle="angle3,angleA=0,angleB=-90"),
106106
)
107107

108-
ax.annotate('simple', xy=(2., -1), xycoords='data',
108+
ax.annotate('simple', xy=(2., -1), xycoords='data',
109109
xytext=(100, 60), textcoords='offset points',
110110
size=20,
111111
#bbox=dict(boxstyle="round", fc="0.8"),
@@ -115,7 +115,7 @@
115115
connectionstyle="arc3,rad=0.3"),
116116
)
117117

118-
ax.annotate('wedge', xy=(2., -1), xycoords='data',
118+
ax.annotate('wedge', xy=(2., -1), xycoords='data',
119119
xytext=(-100, -100), textcoords='offset points',
120120
size=20,
121121
#bbox=dict(boxstyle="round", fc="0.8"),
@@ -125,7 +125,7 @@
125125
connectionstyle="arc3,rad=-0.3"),
126126
)
127127

128-
ann = ax.annotate('wedge', xy=(2., -1), xycoords='data',
128+
ann = ax.annotate('wedge', xy=(2., -1), xycoords='data',
129129
xytext=(0, -45), textcoords='offset points',
130130
size=20,
131131
bbox=dict(boxstyle="round", fc=(1.0, 0.7, 0.7), ec=(1., .5, .5)),
@@ -137,7 +137,7 @@
137137
connectionstyle="arc3,rad=-0.1"),
138138
)
139139

140-
ann = ax.annotate('wedge', xy=(2., -1), xycoords='data',
140+
ann = ax.annotate('wedge', xy=(2., -1), xycoords='data',
141141
xytext=(35, 0), textcoords='offset points',
142142
size=20, va="center",
143143
bbox=dict(boxstyle="round", fc=(1.0, 0.7, 0.7), ec="none"),

examples/pylab_examples/annotation_demo3.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,43 @@
55
bbox_args = dict(boxstyle="round", fc="0.8")
66
arrow_args = dict(arrowstyle="->")
77

8-
ax1.annotate('figure fraction : 0, 0', xy=(0, 0), xycoords='figure fraction',
8+
ax1.annotate('figure fraction : 0, 0', xy=(0, 0), xycoords='figure fraction',
99
xytext=(20, 20), textcoords='offset points',
1010
ha="left", va="bottom",
1111
bbox=bbox_args,
1212
arrowprops=arrow_args
1313
)
1414

15-
ax1.annotate('figure fraction : 1, 1', xy=(1, 1), xycoords='figure fraction',
15+
ax1.annotate('figure fraction : 1, 1', xy=(1, 1), xycoords='figure fraction',
1616
xytext=(-20, -20), textcoords='offset points',
1717
ha="right", va="top",
1818
bbox=bbox_args,
1919
arrowprops=arrow_args
2020
)
2121

22-
ax1.annotate('axes fraction : 0, 0', xy=(0, 0), xycoords='axes fraction',
22+
ax1.annotate('axes fraction : 0, 0', xy=(0, 0), xycoords='axes fraction',
2323
xytext=(20, 20), textcoords='offset points',
2424
ha="left", va="bottom",
2525
bbox=bbox_args,
2626
arrowprops=arrow_args
2727
)
2828

29-
ax1.annotate('axes fraction : 1, 1', xy=(1, 1), xycoords='axes fraction',
29+
ax1.annotate('axes fraction : 1, 1', xy=(1, 1), xycoords='axes fraction',
3030
xytext=(-20, -20), textcoords='offset points',
3131
ha="right", va="top",
3232
bbox=bbox_args,
3333
arrowprops=arrow_args
3434
)
3535

3636

37-
an1 = ax1.annotate('Drag me 1', xy=(.5, .7), xycoords='data',
37+
an1 = ax1.annotate('Drag me 1', xy=(.5, .7), xycoords='data',
3838
#xytext=(.5, .7), textcoords='data',
3939
ha="center", va="center",
4040
bbox=bbox_args,
4141
#arrowprops=arrow_args
4242
)
4343

44-
an2 = ax1.annotate('Drag me 2', xy=(.5, .5), xycoords=an1,
44+
an2 = ax1.annotate('Drag me 2', xy=(.5, .5), xycoords=an1,
4545
xytext=(.5, .3), textcoords='axes fraction',
4646
ha="center", va="center",
4747
bbox=bbox_args,
@@ -50,8 +50,8 @@
5050
**arrow_args)
5151
)
5252

53-
an3 = ax1.annotate('', xy=(.5, .5), xycoords=an2,
54-
xytext=(.5, .5), textcoords=an1,
53+
an3 = ax1.annotate('', xy=(.5, .5), xycoords=an2,
54+
xytext=(.5, .5), textcoords=an1,
5555
ha="center", va="center",
5656
bbox=bbox_args,
5757
arrowprops=dict(patchA=an1.get_bbox_patch(),
@@ -62,7 +62,7 @@
6262

6363

6464
t = ax2.annotate('xy=(0, 1)\nxycoords=("data", "axes fraction")',
65-
xy=(0, 1), xycoords=("data", 'axes fraction'),
65+
xy=(0, 1), xycoords=("data", 'axes fraction'),
6666
xytext=(0, -20), textcoords='offset points',
6767
ha="center", va="top",
6868
bbox=bbox_args,
@@ -72,15 +72,15 @@
7272
from matplotlib.text import OffsetFrom
7373

7474
ax2.annotate('xy=(0.5, 0)\nxycoords=artist',
75-
xy=(0.5, 0.), xycoords=t,
75+
xy=(0.5, 0.), xycoords=t,
7676
xytext=(0, -20), textcoords='offset points',
7777
ha="center", va="top",
7878
bbox=bbox_args,
7979
arrowprops=arrow_args
8080
)
8181

8282
ax2.annotate('xy=(0.8, 0.5)\nxycoords=ax1.transData',
83-
xy=(0.8, 0.5), xycoords=ax1.transData,
83+
xy=(0.8, 0.5), xycoords=ax1.transData,
8484
xytext=(10, 10), textcoords=OffsetFrom(ax2.bbox, (0, 0), "points"),
8585
ha="left", va="bottom",
8686
bbox=bbox_args,

examples/pylab_examples/bar_stacked.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
ind = np.arange(N) # the x locations for the groups
1313
width = 0.35 # the width of the bars: can also be len(x) sequence
1414

15-
p1 = plt.bar(ind, menMeans, width, color='r', yerr=womenStd)
15+
p1 = plt.bar(ind, menMeans, width, color='r', yerr=womenStd)
1616
p2 = plt.bar(ind, womenMeans, width, color='y',
1717
bottom=menMeans, yerr=menStd)
1818

examples/pylab_examples/boxplot_demo2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
lognBoot = logn[bootstrapIndices]
3232
triaBoot = tria[bootstrapIndices]
3333

34-
data = [norm, normBoot, logn, lognBoot, expo, expoBoot, gumb, gumbBoot,
34+
data = [norm, normBoot, logn, lognBoot, expo, expoBoot, gumb, gumbBoot,
3535
tria, triaBoot]
3636

3737
fig, ax1 = plt.subplots(figsize=(10, 6))
@@ -106,7 +106,7 @@
106106
color=boxColors[k])
107107

108108
# Finally, add a basic legend
109-
plt.figtext(0.80, 0.08, str(N) + ' Random Numbers' ,
109+
plt.figtext(0.80, 0.08, str(N) + ' Random Numbers' ,
110110
backgroundcolor=boxColors[0], color='black', weight='roman',
111111
size='x-small')
112112
plt.figtext(0.80, 0.045, 'IID Bootstrap Resample',

examples/pylab_examples/boxplot_demo3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@ def fakeBootStrapper(n):
4242

4343
ax.set_xlabel('treatment')
4444
ax.set_ylabel('response')
45-
plt.setp(bp['whiskers'], color='k', linestyle='-')
45+
plt.setp(bp['whiskers'], color='k', linestyle='-')
4646
plt.setp(bp['fliers'], markersize=3.0)
4747
plt.show()

examples/pylab_examples/broken_barh.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
fig, ax = plt.subplots()
77
ax.broken_barh([(110, 30), (150, 10)] , (10, 9), facecolors='blue')
8-
ax.broken_barh([(10, 50), (100, 20), (130, 10)] , (20, 9),
8+
ax.broken_barh([(10, 50), (100, 20), (130, 10)], (20, 9),
99
facecolors=('red', 'yellow', 'green'))
1010
ax.set_ylim(5, 35)
1111
ax.set_xlim(0, 200)

examples/pylab_examples/custom_ticker1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ def millions(x, pos):
2727
fig, ax = plt.subplots()
2828
ax.yaxis.set_major_formatter(formatter)
2929
plt.bar(x, money)
30-
plt.xticks(x + 0.5, ('Bill', 'Fred', 'Mary', 'Sue'))
30+
plt.xticks(x + 0.5, ('Bill', 'Fred', 'Mary', 'Sue'))
3131
plt.show()

examples/pylab_examples/fonts_demo_kw.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949

5050
weight = ['light', 'normal', 'medium', 'semibold', 'bold', 'heavy', 'black']
5151

52-
t = text(0.4, 0.9, 'weight', **alignment)
52+
t = text(0.4, 0.9, 'weight', **alignment)
5353

5454
for k in range(7):
5555
t = text(0.4, yp[k], weight[k], weight=weight[k],

examples/pylab_examples/ganged_plots.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
ax2 = subplot(312, sharex=ax1)
3333
ax2.plot(t, s2)
34-
yticks(arange(0.1, 1.0, 0.2))
34+
yticks(arange(0.1, 1.0, 0.2))
3535
ylim(0, 1)
3636

3737
ax3 = subplot(313, sharex=ax1)

0 commit comments

Comments
 (0)