Skip to content

fix pep8 error classes e20[12] and e22[12] in examples #3635

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 17, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/color/color_cycle_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
yy = np.transpose([np.sin(x + phi) for phi in offsets])

plt.rc('lines', linewidth=4)
fig, (ax0, ax1) = plt.subplots(nrows=2)
fig, (ax0, ax1) = plt.subplots(nrows=2)

plt.rc('axes', color_cycle=['r', 'g', 'b', 'y'])
ax0.plot(yy)
Expand Down
2 changes: 1 addition & 1 deletion examples/event_handling/looking_glass.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
x, y = np.random.rand(2, 200)

fig, ax = plt.subplots()
circ = patches.Circle( (0.5, 0.5), 0.25, alpha=0.8, fc='yellow')
circ = patches.Circle((0.5, 0.5), 0.25, alpha=0.8, fc='yellow')
ax.add_patch(circ)


Expand Down
8 changes: 4 additions & 4 deletions examples/event_handling/pipong.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def __init__(self, disp, pad, field):
def _reset(self,pad):
self.x = pad.x + pad.xoffset
if pad.y < 0:
self.y = pad.y + pad.yoffset
self.y = pad.y + pad.yoffset
else:
self.y = pad.y - pad.yoffset
self.vx = pad.x - self.x
Expand Down Expand Up @@ -145,15 +145,15 @@ def __init__(self, ax):
self.inst = True # show instructions from the beginning
self.background = None
self.pads = []
self.pads.append( Pad(pA,0,padAy))
self.pads.append( Pad(pB,padBx,padBy,'r'))
self.pads.append(Pad(pA,0,padAy))
self.pads.append(Pad(pB,padBx,padBy,'r'))
self.pucks =[]
self.i = self.ax.annotate(instructions,(.5,0.5),
name='monospace',
verticalalignment='center',
horizontalalignment='center',
multialignment='left',
textcoords='axes fraction',animated=True )
textcoords='axes fraction',animated=True)
self.canvas.mpl_connect('key_press_event', self.key_press)

def draw(self, evt):
Expand Down
16 changes: 8 additions & 8 deletions examples/misc/contour_manual.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
import matplotlib.cm as cm

# Contour lines for each level are a list/tuple of polygons.
lines0 = [ [[0,0],[0,4]] ]
lines1 = [ [[2,0],[1,2],[1,3]] ]
lines2 = [ [[3,0],[3,2]], [[3,3],[3,4]] ] # Note two lines.
lines0 = [[[0,0],[0,4]]]
lines1 = [[[2,0],[1,2],[1,3]]]
lines2 = [[[3,0],[3,2]], [[3,3],[3,4]]] # Note two lines.

# Filled contours between two levels are also a list/tuple of polygons.
# Points can be ordered clockwise or anticlockwise.
filled01 = [ [[0,0],[0,4],[1,3],[1,2],[2,0]] ]
filled12 = [ [[2,0],[3,0],[3,2],[1,3],[1,2]], # Note two polygons.
[[1,4],[3,4],[3,3]] ]
filled01 = [[[0,0],[0,4],[1,3],[1,2],[2,0]]]
filled12 = [[[2,0],[3,0],[3,2],[1,3],[1,2]], # Note two polygons.
[[1,4],[3,4],[3,3]]]


plt.figure()
Expand All @@ -38,8 +38,8 @@
# Here a code type of 1 is a MOVETO, and 2 is a LINETO.

plt.figure()
filled01 = [ [[0,0],[3,0],[3,3],[0,3],[1,1],[1,2],[2,2],[2,1]] ]
kinds01 = [ [1,2,2,2,1,2,2,2] ]
filled01 = [[[0,0],[3,0],[3,3],[0,3],[1,1],[1,2],[2,2],[2,1]]]
kinds01 = [[1,2,2,2,1,2,2,2]]
cs = ContourSet(plt.gca(), [0,1], [filled01], [kinds01], filled=True)
cbar = plt.colorbar(cs)

Expand Down
2 changes: 1 addition & 1 deletion examples/misc/font_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
coded[name] = ccode
glyphd[name] = glyphind

code = coded['A']
code = coded['A']
glyph = font.load_char(code)
#print glyph.bbox
print(glyphd['A'], glyphd['V'], coded['A'], coded['V'])
Expand Down
38 changes: 19 additions & 19 deletions examples/misc/rc_traits.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
doprint = True
flexible_true_trait = traits.Trait(
True,
{ 'true': True, 't': True, 'yes': True, 'y': True, 'on': True, True: True,
{'true': True, 't': True, 'yes': True, 'y': True, 'on': True, True: True,
'false': False, 'f': False, 'no': False, 'n': False, 'off': False, False: False
} )
flexible_false_trait = traits.Trait( False, flexible_true_trait )
})
flexible_false_trait = traits.Trait(False, flexible_true_trait)

colors = {
'c' : '#00bfbf',
Expand Down Expand Up @@ -83,7 +83,7 @@ def hex_to_rgba(ob, name, val):

def colorname_to_rgba(ob, name, val):
hex = colors[val.lower()]
r,g,b = hex2color(hex)
r,g,b = hex2color(hex)
return RGBA(r,g,b,1.0)
colorname_to_rgba.info = 'a named color'

Expand All @@ -102,7 +102,7 @@ def file_exists(ob, name, val):
fh = file(val, 'r')
return val

linestyles = ('-', '--', '-.', ':', 'steps', 'None')
linestyles = ('-', '--', '-.', ':', 'steps', 'None')
TICKLEFT, TICKRIGHT, TICKUP, TICKDOWN = range(4)
linemarkers = (None, '.', ',', 'o', '^', 'v', '<', '>', 's',
'+', 'x', 'd', 'D', '|', '_', 'h', 'H',
Expand All @@ -116,23 +116,23 @@ def file_exists(ob, name, val):


class LineRC(traits.HasTraits):
linewidth = traits.Float(0.5)
linestyle = traits.Trait(*linestyles)
color = Color
marker = traits.Trait(*linemarkers)
linewidth = traits.Float(0.5)
linestyle = traits.Trait(*linestyles)
color = Color
marker = traits.Trait(*linemarkers)
markerfacecolor = Color
markeredgecolor = Color
markeredgewidth = traits.Float(0.5)
markersize = traits.Float(6)
antialiased = flexible_true_trait
data_clipping = flexible_false_trait
markersize = traits.Float(6)
antialiased = flexible_true_trait
data_clipping = flexible_false_trait


class PatchRC(traits.HasTraits):
linewidth = traits.Float(1.0)
linewidth = traits.Float(1.0)
facecolor = Color
edgecolor = Color
antialiased = flexible_true_trait
antialiased = flexible_true_trait

timezones = 'UTC', 'US/Central', 'ES/Eastern' # fixme: and many more
backends = ('GTKAgg', 'Cairo', 'GDK', 'GTK', 'Agg',
Expand All @@ -142,11 +142,11 @@ class PatchRC(traits.HasTraits):

class RC(traits.HasTraits):
backend = traits.Trait(*backends)
interactive = flexible_false_trait
toolbar = traits.Trait('toolbar2', 'classic', None)
timezone = traits.Trait(*timezones)
lines = traits.Trait(LineRC())
patch = traits.Trait(PatchRC())
interactive = flexible_false_trait
toolbar = traits.Trait('toolbar2', 'classic', None)
timezone = traits.Trait(*timezones)
lines = traits.Trait(LineRC())
patch = traits.Trait(PatchRC())

rc = RC()
rc.lines.color = 'r'
Expand Down
2 changes: 1 addition & 1 deletion examples/pylab_examples/anchored_artists.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def __init__(self, width, height, xdescent, ydescent,

# draw a horizontal bar with length of 0.1 in Data coordinate
# (ax.transData) with a label underneath.
asb = AnchoredSizeBar(ax.transData,
asb = AnchoredSizeBar(ax.transData,
0.1,
r"1$^{\prime}$",
loc=8,
Expand Down
4 changes: 2 additions & 2 deletions examples/pylab_examples/anscombe.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from pylab import *

x = array([10, 8, 13, 9, 11, 14, 6, 4, 12, 7, 5])
x = array([10, 8, 13, 9, 11, 14, 6, 4, 12, 7, 5])
y1 = array([8.04, 6.95, 7.58, 8.81, 8.33, 9.96, 7.24, 4.26, 10.84, 4.82, 5.68])
y2 = array([9.14, 8.14, 8.74, 8.77, 9.26, 8.10, 6.13, 3.10, 9.13, 7.26, 4.74])
y3 = array([7.46, 6.77, 12.74, 7.11, 7.81, 8.84, 6.08, 5.39, 8.15, 6.42, 5.73])
Expand All @@ -23,7 +23,7 @@ def fit(x):
return 3+0.5*x


xfit = array( [amin(x), amax(x) ] )
xfit = array([amin(x), amax(x)])

subplot(221)
plot(x,y1,'ks', xfit, fit(xfit), 'r-', lw=2)
Expand Down
2 changes: 1 addition & 1 deletion examples/pylab_examples/axes_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

# the main axes is subplot(111) by default
plot(t, s)
axis([0, 1, 1.1*amin(s), 2*amax(s) ])
axis([0, 1, 1.1*amin(s), 2*amax(s)])
xlabel('time (s)')
ylabel('current (nA)')
title('Gaussian colored noise')
Expand Down
8 changes: 4 additions & 4 deletions examples/pylab_examples/axis_equal_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@
an = linspace(0,2*pi,100)

subplot(221)
plot( 3*cos(an), 3*sin(an) )
plot(3*cos(an), 3*sin(an))
title('not equal, looks like ellipse',fontsize=10)

subplot(222)
plot( 3*cos(an), 3*sin(an) )
plot(3*cos(an), 3*sin(an))
axis('equal')
title('equal, looks like circle',fontsize=10)

subplot(223)
plot( 3*cos(an), 3*sin(an) )
plot(3*cos(an), 3*sin(an))
axis('equal')
axis([-3,3,-3,3])
title('looks like circle, even after changing limits',fontsize=10)

subplot(224)
plot( 3*cos(an), 3*sin(an) )
plot(3*cos(an), 3*sin(an))
axis('equal')
axis([-3,3,-3,3])
plot([0,4],[0,4])
Expand Down
10 changes: 5 additions & 5 deletions examples/pylab_examples/bar_stacked.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@


N = 5
menMeans = (20, 35, 30, 35, 27)
menMeans = (20, 35, 30, 35, 27)
womenMeans = (25, 32, 34, 20, 25)
menStd = (2, 3, 4, 1, 2)
womenStd = (3, 5, 2, 3, 3)
menStd = (2, 3, 4, 1, 2)
womenStd = (3, 5, 2, 3, 3)
ind = np.arange(N) # the x locations for the groups
width = 0.35 # the width of the bars: can also be len(x) sequence

Expand All @@ -18,8 +18,8 @@

plt.ylabel('Scores')
plt.title('Scores by group and gender')
plt.xticks(ind+width/2., ('G1', 'G2', 'G3', 'G4', 'G5') )
plt.xticks(ind+width/2., ('G1', 'G2', 'G3', 'G4', 'G5'))
plt.yticks(np.arange(0,81,10))
plt.legend( (p1[0], p2[0]), ('Men', 'Women') )
plt.legend((p1[0], p2[0]), ('Men', 'Women'))

plt.show()
2 changes: 1 addition & 1 deletion examples/pylab_examples/boxplot_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
center = ones(25) * 40
flier_high = rand(10) * 100 + 100
flier_low = rand(10) * -100
d2 = concatenate( (spread, center, flier_high, flier_low), 0 )
d2 = concatenate((spread, center, flier_high, flier_low), 0)
data.shape = (-1, 1)
d2.shape = (-1, 1)
#data = concatenate( (data, d2), 1 )
Expand Down
2 changes: 1 addition & 1 deletion examples/pylab_examples/boxplot_demo3.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ def fakeBootStrapper(n):

ax.set_xlabel('treatment')
ax.set_ylabel('response')
plt.setp(bp['whiskers'], color='k', linestyle='-' )
plt.setp(bp['whiskers'], color='k', linestyle='-')
plt.setp(bp['fliers'], markersize=3.0)
plt.show()
2 changes: 1 addition & 1 deletion examples/pylab_examples/broken_axis.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


# 30 points between 0 0.2] originally made using np.random.rand(30)*.2
pts = np.array([ 0.015, 0.166, 0.133, 0.159, 0.041, 0.024, 0.195,
pts = np.array([0.015, 0.166, 0.133, 0.159, 0.041, 0.024, 0.195,
0.039, 0.161, 0.018, 0.143, 0.056, 0.125, 0.096, 0.094, 0.051,
0.043, 0.021, 0.138, 0.075, 0.109, 0.195, 0.05 , 0.074, 0.079,
0.155, 0.02 , 0.01 , 0.061, 0.008])
Expand Down
4 changes: 2 additions & 2 deletions examples/pylab_examples/broken_barh.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import matplotlib.pyplot as plt

fig, ax = plt.subplots()
ax.broken_barh([ (110, 30), (150, 10) ] , (10, 9), facecolors='blue')
ax.broken_barh([ (10, 50), (100, 20), (130, 10)] , (20, 9),
ax.broken_barh([(110, 30), (150, 10)] , (10, 9), facecolors='blue')
ax.broken_barh([(10, 50), (100, 20), (130, 10)] , (20, 9),
facecolors=('red', 'yellow', 'green'))
ax.set_ylim(5,35)
ax.set_xlim(0,200)
Expand Down
6 changes: 3 additions & 3 deletions examples/pylab_examples/contour_label_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def __repr__(self):
return '%.1f' % self.__float__()

# Recast levels to new class
CS.levels = [nf(val) for val in CS.levels ]
CS.levels = [nf(val) for val in CS.levels]

# Label levels with specially formatted floats
if plt.rcParams["text.usetex"]:
Expand All @@ -67,8 +67,8 @@ def __repr__(self):
CS = plt.contour(X, Y, Z)

fmt = {}
strs = [ 'first', 'second', 'third', 'fourth', 'fifth', 'sixth', 'seventh' ]
for l,s in zip( CS.levels, strs ):
strs = ['first', 'second', 'third', 'fourth', 'fifth', 'sixth', 'seventh']
for l,s in zip(CS.levels, strs):
fmt[l] = s

# Label every other level using strings
Expand Down
4 changes: 2 additions & 2 deletions examples/pylab_examples/coords_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
def millions(x):
return '$%1.1fM' % (x*1e-6)

x = rand(20)
y = 1e7*rand(20)
x = rand(20)
y = 1e7*rand(20)

fig, ax = subplots()
ax.fmt_ydata = millions
Expand Down
16 changes: 8 additions & 8 deletions examples/pylab_examples/cursor_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ def __init__(self, ax):
self.ly = ax.axvline(color='k') # the vert line

# text location in axes coords
self.txt = ax.text( 0.7, 0.9, '', transform=ax.transAxes)
self.txt = ax.text(0.7, 0.9, '', transform=ax.transAxes)

def mouse_move(self, event):
if not event.inaxes: return

x, y = event.xdata, event.ydata
# update the line positions
self.lx.set_ydata(y )
self.ly.set_xdata(x )
self.lx.set_ydata(y)
self.ly.set_xdata(x)

self.txt.set_text( 'x=%1.2f, y=%1.2f'%(x,y) )
self.txt.set_text('x=%1.2f, y=%1.2f'%(x,y))
draw()


Expand All @@ -48,7 +48,7 @@ def __init__(self, ax, x, y):
self.x = x
self.y = y
# text location in axes coords
self.txt = ax.text( 0.7, 0.9, '', transform=ax.transAxes)
self.txt = ax.text(0.7, 0.9, '', transform=ax.transAxes)

def mouse_move(self, event):

Expand All @@ -60,10 +60,10 @@ def mouse_move(self, event):
x = self.x[indx]
y = self.y[indx]
# update the line positions
self.lx.set_ydata(y )
self.ly.set_xdata(x )
self.lx.set_ydata(y)
self.ly.set_xdata(x)

self.txt.set_text( 'x=%1.2f, y=%1.2f'%(x,y) )
self.txt.set_text('x=%1.2f, y=%1.2f'%(x,y))
print ('x=%1.2f, y=%1.2f'%(x,y))
draw()

Expand Down
4 changes: 2 additions & 2 deletions examples/pylab_examples/custom_ticker1.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import matplotlib.pyplot as plt
import numpy as np

x = np.arange(4)
x = np.arange(4)
money = [1.5e5, 2.5e6, 5.5e6, 2.0e7]


Expand All @@ -27,5 +27,5 @@ def millions(x, pos):
fig, ax = plt.subplots()
ax.yaxis.set_major_formatter(formatter)
plt.bar(x, money)
plt.xticks( x + 0.5, ('Bill', 'Fred', 'Mary', 'Sue') )
plt.xticks(x + 0.5, ('Bill', 'Fred', 'Mary', 'Sue'))
plt.show()
Loading