Skip to content

Commit

Permalink
Merge pull request #3664 from thisch/fix_e27_e251
Browse files Browse the repository at this point in the history
PEP8 : [examples] pep8 fix e251 e27*
  • Loading branch information
tacaswell committed Oct 18, 2014
2 parents 31f2c8f + 82a73d7 commit 585c1ad
Show file tree
Hide file tree
Showing 31 changed files with 109 additions and 109 deletions.
Expand Up @@ -23,28 +23,28 @@
[0.6, 0.3, 0.0, 0.2], [0.7, 0.9, 0.4, 0.6]])

#Create a 2x2 table of plots
fig = plt.figure(figsize = [8.0, 7.5])
fig = plt.figure(figsize=[8.0, 7.5])
ax = plt.subplot(2,2,1)
ax.imshow(big_im, interpolation = 'none')
ax.imshow(big_im, interpolation='none')
ax = plt.subplot(2,2,2)
ax.imshow(big_im, interpolation = 'nearest')
ax.imshow(big_im, interpolation='nearest')
ax = plt.subplot(2,2,3)
ax.imshow(small_im, interpolation = 'none')
ax.imshow(small_im, interpolation='none')
ax = plt.subplot(2,2,4)
ax.imshow(small_im, interpolation = 'nearest')
plt.subplots_adjust(left = 0.24, wspace = 0.2, hspace = 0.1, \
bottom = 0.05, top = 0.86)
ax.imshow(small_im, interpolation='nearest')
plt.subplots_adjust(left=0.24, wspace=0.2, hspace=0.1, \
bottom=0.05, top=0.86)

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

#If you were going to run this example on your local machine, you
#would save the figure as a PNG, save the same figure as a PDF, and
#then compare them. The following code would suffice.
txt = fig.text(0.452, 0.95, 'Saved as a PNG', fontsize = 18)
txt = fig.text(0.452, 0.95, 'Saved as a PNG', fontsize=18)
# plt.savefig('None_vs_nearest-png.png')
# txt.set_text('Saved as a PDF')
# plt.savefig('None_vs_nearest-pdf.pdf')
Expand All @@ -56,7 +56,7 @@
#display it.
pdf_im_path = cbook.get_sample_data('None_vs_nearest-pdf.png')
pdf_im = plt.imread(pdf_im_path)
fig2 = plt.figure(figsize = [8.0, 7.5])
fig2 = plt.figure(figsize=[8.0, 7.5])
plt.figimage(pdf_im)

plt.show()
4 changes: 2 additions & 2 deletions examples/misc/multiprocess.py
Expand Up @@ -64,8 +64,8 @@ class NBPlot(object):
def __init__(self):
self.plot_pipe, plotter_pipe = Pipe()
self.plotter = ProcessPlotter()
self.plot_process = Process(target = self.plotter,
args = (plotter_pipe,))
self.plot_process = Process(target=self.plotter,
args=(plotter_pipe,))
self.plot_process.daemon = True
self.plot_process.start()

Expand Down
2 changes: 1 addition & 1 deletion examples/misc/rc_traits.py
Expand Up @@ -170,7 +170,7 @@ def __init__(self,
edgecolor=None,
facecolor=None,
linewidth=None,
antialiased = None,
antialiased=None,
fill=1,
**kwargs
):
Expand Down
2 changes: 1 addition & 1 deletion examples/mplot3d/polys3d_demo.py
Expand Up @@ -17,7 +17,7 @@
ys[0], ys[-1] = 0, 0
verts.append(list(zip(xs, ys)))

poly = PolyCollection(verts, facecolors = [cc('r'), cc('g'), cc('b'),
poly = PolyCollection(verts, facecolors=[cc('r'), cc('g'), cc('b'),
cc('y')])
poly.set_alpha(0.7)
ax.add_collection3d(poly, zs=zs, zdir='y')
Expand Down
2 changes: 1 addition & 1 deletion examples/pylab_examples/arrow_demo.py
Expand Up @@ -25,7 +25,7 @@ def add_dicts(d1, d2):


def make_arrow_plot(data, size=4, display='length', shape='right', \
max_arrow_width=0.03, arrow_sep = 0.02, alpha=0.5, \
max_arrow_width=0.03, arrow_sep=0.02, alpha=0.5, \
normalize_data=False, ec=None, labelcolor=None, \
head_starts_at_zero=True, rate_labels=lettered_bases_to_rates,\
**kwargs):
Expand Down
2 changes: 1 addition & 1 deletion examples/pylab_examples/color_by_yvalue.py
@@ -1,7 +1,7 @@
# use masked arrays to plot a line with different colors by y-value
from numpy import logical_or, arange, sin, pi
from numpy import ma
from matplotlib.pyplot import plot, show
from matplotlib.pyplot import plot, show

t = arange(0.0, 2.0, 0.01)
s = sin(2*pi*t)
Expand Down
12 changes: 6 additions & 6 deletions examples/pylab_examples/contour_image.py
Expand Up @@ -47,7 +47,7 @@
# of the polygons in the collections returned by contourf.
# Use levels output from previous call to guarantee they are the same.
cset2 = contour(X, Y, Z, cset1.levels,
colors = 'k',
colors='k',
hold='on')
# We don't really need dashed contour lines to indicate negative
# regions, so let's turn them off.
Expand All @@ -59,8 +59,8 @@
# We are making a thick green line as a zero contour.
# Specify the zero level as a tuple with only 0 in it.
cset3 = contour(X, Y, Z, (0,),
colors = 'g',
linewidths = 2,
colors='g',
linewidths=2,
hold='on')
title('Filled contours')
colorbar(cset1)
Expand All @@ -71,7 +71,7 @@

imshow(Z, extent=extent, cmap=cmap, norm=norm)
v = axis()
contour(Z, levels, hold='on', colors = 'k',
contour(Z, levels, hold='on', colors='k',
origin='upper', extent=extent)
axis(v)
title("Image, origin 'upper'")
Expand All @@ -80,7 +80,7 @@

imshow(Z, origin='lower', extent=extent, cmap=cmap, norm=norm)
v = axis()
contour(Z, levels, hold='on', colors = 'k',
contour(Z, levels, hold='on', colors='k',
origin='lower', extent=extent)
axis(v)
title("Image, origin 'lower'")
Expand All @@ -95,7 +95,7 @@
# domain that is contoured does not extend beyond these pixel centers.
im = imshow(Z, interpolation='nearest', extent=extent, cmap=cmap, norm=norm)
v = axis()
contour(Z, levels, hold='on', colors = 'k',
contour(Z, levels, hold='on', colors='k',
origin='image', extent=extent)
axis(v)
ylim = get(gca(), 'ylim')
Expand Down
8 changes: 4 additions & 4 deletions examples/pylab_examples/contourf_demo.py
Expand Up @@ -44,7 +44,7 @@
# or leave out the levels kwarg to use all of the original levels.

CS2 = plt.contour(CS, levels=CS.levels[::2],
colors = 'r',
colors='r',
origin=origin,
hold='on')

Expand All @@ -65,7 +65,7 @@
# of colors.
levels = [-1.5, -1, -0.5, 0, 0.5, 1]
CS3 = plt.contourf(X, Y, Z, levels,
colors = ('r', 'g', 'b'),
colors=('r', 'g', 'b'),
origin=origin,
extend='both')
# Our data range extends outside the range of levels; make
Expand All @@ -75,11 +75,11 @@
CS3.cmap.set_over('cyan')

CS4 = plt.contour(X, Y, Z, levels,
colors = ('k',),
colors=('k',),
linewidths = (3,),
origin = origin)
plt.title('Listed colors (3 masked regions)')
plt.clabel(CS4, fmt = '%2.1f', colors = 'w', fontsize=14)
plt.clabel(CS4, fmt='%2.1f', colors='w', fontsize=14)

# Notice that the colorbar command gets all the information it
# needs from the ContourSet object, CS3.
Expand Down
6 changes: 3 additions & 3 deletions examples/pylab_examples/demo_bboximage.py
Expand Up @@ -12,7 +12,7 @@
kwargs = dict()

bbox_image = BboxImage(txt.get_window_extent,
norm = None,
norm=None,
origin=None,
clip_on=False,
**kwargs
Expand Down Expand Up @@ -48,8 +48,8 @@
bbox = TransformedBbox(bbox0, ax.transAxes)

bbox_image = BboxImage(bbox,
cmap = plt.get_cmap(m),
norm = None,
cmap=plt.get_cmap(m),
norm=None,
origin=None,
**kwargs
)
Expand Down
12 changes: 6 additions & 6 deletions examples/pylab_examples/demo_ribbon_box.py
Expand Up @@ -51,24 +51,24 @@ class RibbonBoxImage(BboxImage):
zorder = 1

def __init__(self, bbox, color,
cmap = None,
norm = None,
cmap=None,
norm=None,
interpolation=None,
origin=None,
filternorm=1,
filterrad=4.0,
resample = False,
resample=False,
**kwargs
):

BboxImage.__init__(self, bbox,
cmap = cmap,
norm = norm,
cmap=cmap,
norm=norm,
interpolation=interpolation,
origin=origin,
filternorm=filternorm,
filterrad=filterrad,
resample = resample,
resample=resample,
**kwargs
)

Expand Down
2 changes: 1 addition & 1 deletion examples/pylab_examples/demo_text_path.py
Expand Up @@ -35,7 +35,7 @@ def set_facecolor(self, color):
def _init_bbox_image(self, im):

bbox_image = BboxImage(self.get_window_extent,
norm = None,
norm=None,
origin=None,
)
bbox_image.set_transform(IdentityTransform())
Expand Down
4 changes: 2 additions & 2 deletions examples/pylab_examples/fancytextbox_demo.py
Expand Up @@ -2,15 +2,15 @@

plt.text(0.6, 0.5, "test", size=50, rotation=30.,
ha="center", va="center",
bbox = dict(boxstyle="round",
bbox=dict(boxstyle="round",
ec=(1., 0.5, 0.5),
fc=(1., 0.8, 0.8),
)
)

plt.text(0.5, 0.4, "test", size=50, rotation=-30.,
ha="right", va="top",
bbox = dict(boxstyle="square",
bbox=dict(boxstyle="square",
ec=(1., 0.5, 0.5),
fc=(1., 0.8, 0.8),
)
Expand Down
2 changes: 1 addition & 1 deletion examples/pylab_examples/fonts_demo_kw.py
Expand Up @@ -72,7 +72,7 @@
**alignment)

t = text(x, 0.2, 'bold italic',
style = 'italic', weight='bold', size='medium',
style='italic', weight='bold', size='medium',
**alignment)

t = text(x, 0.3, 'bold italic',
Expand Down
2 changes: 1 addition & 1 deletion examples/pylab_examples/hexbin_demo2.py
Expand Up @@ -4,7 +4,7 @@
"""

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab

delta = 0.025
Expand Down
6 changes: 3 additions & 3 deletions examples/pylab_examples/image_masked.py
Expand Up @@ -36,16 +36,16 @@
subplot(1,2,1)
im = imshow(Zm, interpolation='bilinear',
cmap=palette,
norm = colors.Normalize(vmin = -1.0, vmax = 1.0, clip = False),
norm=colors.Normalize(vmin=-1.0, vmax=1.0, clip=False),
origin='lower', extent=[-3,3,-3,3])
title('Green=low, Red=high, Blue=bad')
colorbar(im, extend='both', orientation='horizontal', shrink=0.8)

subplot(1,2,2)
im = imshow(Zm, interpolation='nearest',
cmap=palette,
norm = colors.BoundaryNorm([-1, -0.5, -0.2, 0, 0.2, 0.5, 1],
ncolors=256, clip = False),
norm=colors.BoundaryNorm([-1, -0.5, -0.2, 0, 0.2, 0.5, 1],
ncolors=256, clip=False),
origin='lower', extent=[-3,3,-3,3])
title('With BoundaryNorm')
colorbar(im, extend='both', spacing='proportional',
Expand Down
2 changes: 1 addition & 1 deletion examples/pylab_examples/line_collection.py
Expand Up @@ -31,7 +31,7 @@
# If linestyle is omitted, 'solid' is used
# See matplotlib.collections.LineCollection for more information
line_segments = LineCollection(segs,
linewidths = (0.5,1,1.5,2),
linewidths=(0.5,1,1.5,2),
colors = [colorConverter.to_rgba(i) \
for i in ('b','g','r','c','m','y','k')],
linestyle = 'solid')
Expand Down
2 changes: 1 addition & 1 deletion examples/pylab_examples/line_collection2.py
Expand Up @@ -22,7 +22,7 @@
# If linestyle is omitted, 'solid' is used
# See matplotlib.collections.LineCollection for more information
line_segments = LineCollection([list(zip(x,y)) for y in ys], # Make a sequence of x,y pairs
linewidths = (0.5,1,1.5,2),
linewidths=(0.5,1,1.5,2),
linestyles = 'solid')
line_segments.set_array(x)
ax.add_collection(line_segments)
Expand Down
2 changes: 1 addition & 1 deletion examples/pylab_examples/logo.py
Expand Up @@ -19,7 +19,7 @@
fontsize=40, fontname='Courier',
horizontalalignment='center',
verticalalignment='center',
transform = ax.transAxes,
transform=ax.transAxes,
)
axis([1, 1.72,-60, 10])
setp(gca(), 'xticklabels', [])
Expand Down
2 changes: 1 addition & 1 deletion examples/pylab_examples/markevery_demo.py
Expand Up @@ -90,7 +90,7 @@
for i, case in enumerate(cases):
row = (i // cols)
col = i % cols
axpolar.append(fig4.add_subplot(gs[row, col], polar = True))
axpolar.append(fig4.add_subplot(gs[row, col], polar=True))
axpolar[-1].set_title('markevery=%s' % str(case))
axpolar[-1].plot(theta, r, 'o', ls='-', ms=4, markevery=case)
fig4.tight_layout()
Expand Down
8 changes: 4 additions & 4 deletions examples/pylab_examples/masked_demo.py
Expand Up @@ -16,11 +16,11 @@
ym2 = ma.masked_where(y2 < -0.5, y2)

lines = plot(x, y, 'r', x, ym1, 'g', x, ym2, 'bo')
setp(lines[0], linewidth = 4)
setp(lines[1], linewidth = 2)
setp(lines[2], markersize = 10)
setp(lines[0], linewidth=4)
setp(lines[1], linewidth=2)
setp(lines[2], markersize=10)

legend(('No mask', 'Masked if > 0.5', 'Masked if < -0.5') ,
loc = 'upper right')
loc='upper right')
title('Masked line demo')
show()
6 changes: 3 additions & 3 deletions examples/pylab_examples/multiline.py
Expand Up @@ -13,9 +13,9 @@
#ylabel('this is another!')
text(2, 7,'this is\nyet another test',
rotation=45,
horizontalalignment = 'center',
verticalalignment = 'top',
multialignment = 'center')
horizontalalignment='center',
verticalalignment='top',
multialignment='center')

grid(True)

Expand Down
2 changes: 1 addition & 1 deletion examples/pylab_examples/scatter_custom_symbol.py
Expand Up @@ -12,6 +12,6 @@
s*= 10**2.

fig, ax = plt.subplots()
ax.scatter(x,y,s,c,marker=None,verts =verts)
ax.scatter(x,y,s,c,marker=None,verts=verts)

plt.show()
4 changes: 2 additions & 2 deletions examples/pylab_examples/transoffset.py
Expand Up @@ -32,7 +32,7 @@
# first; the subplot command above is one way to do this.

transOffset = offset_copy(ax.transData, fig=fig,
x = 0.05, y=0.10, units='inches')
x=0.05, y=0.10, units='inches')

for x, y in zip(X, Y):
P.plot((x,),(y,), 'ro')
Expand All @@ -43,7 +43,7 @@

ax = P.subplot(2,1,2, polar=True)

transOffset = offset_copy(ax.transData, fig=fig, y = 6, units='dots')
transOffset = offset_copy(ax.transData, fig=fig, y=6, units='dots')

for x, y in zip(X, Y):
P.polar((x,),(y,), 'ro')
Expand Down

0 comments on commit 585c1ad

Please sign in to comment.