8000 PEP8 moved examples · choldgraf/matplotlib@12fd562 · GitHub
[go: up one dir, main page]

Skip to content

Commit 12fd562

Browse files
committed
PEP8 moved examples
1 parent 5626e57 commit 12fd562

File tree

18 files changed

+54
-43
lines changed

18 files changed

+54
-43
lines changed

examples/event_handling/ginput_manual_clabel_sgskip.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def tellme(s):
3232
##################################################
3333
# Define a triangle by clicking three points
3434

35+
3536
plt.clf()
3637
plt.axis([-1., 1., -1., 1.])
3738
plt.setp(plt.gca(), autoscale_on=False)
@@ -73,6 +74,7 @@ def f(x, y, pts):
7374
z = z + 1/(np.sqrt((x - p[0])**2 + (y - p[1])**2))
7475
return 1/z
7576

77+
7678
X, Y = np.meshgrid(np.linspace(-1, 1, 51), np.linspace(-1, 1, 51))
7779
Z = f(X, Y, pts)
7880

examples/images_contours_and_fields/demo_bboximage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
not m.startswith(('spectral', 'Vega')) # Skip deprecated colormaps.
3838
)
3939

40-
#fig.subplots_adjust(top=0.99, bottom=0.01, left=0.2, right=0.99)
40+
# fig.subplots_adjust(top=0.99, bottom=0.01, left=0.2, right=0.99)
4141

4242
ncol = 2
4343
nrow = len(maps)//ncol + 1
@@ -50,7 +50,7 @@
5050

5151
for i, m in enumerate(maps):
5252
ix, iy = divmod(i, nrow)
53-
#plt.figimage(a, 10, i*10, cmap=plt.get_cmap(m), origin='lower')
53+
# plt.figimage(a, 10, i*10, cmap=plt.get_cmap(m), origin='lower')
5454
bbox0 = Bbox.from_bounds(ix*dx*(1 + xpad_fraction),
5555
1. - iy*dy*(1 + ypad_fraction) - dy,
5656
dx, dy)

examples/lines_bars_and_markers/markevery_demo.py

Lines changed: 0 additions & 1 deletion
8000
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
ax.append(fig1.add_subplot(gs[row, col]))
5656
ax[-1].set_title('markevery=%s' % str(case))
5757
ax[-1].plot(x, y, 'o', ls='-', ms=4, markevery=case)
58-
#fig1.tight_layout()
5958

6059
###############################################################################
6160
# Plot each markevery case for log x and y scales

examples/lines_bars_and_markers/nan_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,5 @@
3030
plt.ylabel('more nans')
3131
plt.grid(True)
3232

33+
plt.tight_layout()
3334
plt.show()

examples/lines_bars_and_markers/xcorr_acorr_demo.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
Cross- and Auto-Correlation Demo
44
================================
55
6-
Example use of cross-correlation (``xcorr``) and auto-correlation (``acorr``) plots.
6+
Example use of cross-correlation (`xcorr`) and auto-correlation (`acorr`)
7+
plots.
78
"""
89
import matplotlib.pyplot as plt
910
import numpy as np
@@ -14,13 +15,11 @@
1415

1516

1617
x, y = np.random.randn(2, 100)
17-
fig = plt.figure()
18-
ax1 = fig.add_subplot(211)
18+
fig, [ax1, ax2] = plt.subplots(2, 1, sharex=True)
1919
ax1.xcorr(x, y, usevlines=True, maxlags=50, normed=True, lw=2)
2020
ax1.grid(True)
2121
ax1.axhline(0, color='black', lw=2)
2222

23-
ax2 = fig.add_subplot(212, sharex=ax1)
2423
ax2.acorr(x, usevlines=True, normed=True, maxlags=50, lw=2)
2524
ax2.grid(True)
2625
ax2.axhline(0, color='black', lw=2)

examples/misc/anchored_artists.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111

1212

1313
class AnchoredText(AnchoredOffsetbox):
14-
def __init__(self, s, loc, pad=0.4, borderpad=0.5, prop=None, frameon=True):
14+
def __init__(self, s, loc, pad=0.4, borderpad=0.5,
15+
prop=None, frameon=True):
1516

1617
self.txt = TextArea(s,
1718
minimumdescent=False)
@@ -26,8 +27,8 @@ class AnchoredSizeBar(AnchoredOffsetbox):
2627
def __init__(self, transform, size, label, loc,
2728
pad=0.1, borderpad=0.1, sep=2, prop=None, frameon=True):
2829
"""
29-
Draw a horizontal bar with the size in data coordinate of the give axes.
30-
A label will be drawn underneath (center-aligned).
30+
Draw a horizontal bar with the size in data coordinate of the given
31+
axes. A label will be drawn underneath (center-aligned).
3132
3233
pad, borderpad in fraction of the legend font size (or prop)
3334
sep in points.
@@ -71,7 +72,8 @@ def __init__(self, width, height, xdescent, ydescent,
7172

7273
self.da = DrawingArea(width, height, xdescent, ydescent)
7374

74-
super(AnchoredDrawingArea, self).__init__(loc, pad=pad, borderpad=borderpad,
75+
super(AnchoredDrawingArea, self).__init__(loc, pad=pad,
76+
borderpad=borderpad,
7577
child=self.da,
7678
prop=None,
7779
frameon=frameon)

examples/misc/coords_report.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
def millions(x):
1414
return '$%1.1fM' % (x*1e-6)
1515

16+
1617
# Fixing random state for reproducibility
1718
np.random.seed(19680801)
1819

examples/misc/cursor_demo_sgskip.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ def mouse_move(self, event):
7777
plt.draw()
7878

7979
t = np.arange(0.0, 1.0, 0.01)
80-
s = np.sin(2*2*np.pi*t)
80+
s = np.sin(2 * 2 * np.pi * t)
8181
fig, ax = plt.subplots()
8282

83-
#cursor = Cursor(ax)
83+
# cursor = Cursor(ax)
8484
cursor = SnaptoCursor(ax, t, s)
8585
plt.connect('motion_notify_event', cursor.mouse_move)
8686

examples/misc/customize_rc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
def set_pub():
1515
rc('font', weight='bold') # bold fonts are easier to see
1616
rc('tick', labelsize=15) # tick labels bigger
17-
rc('lines', lw=1, color='k') # thicker black lines (no budget for color!)
17+
rc('lines', lw=1, color='k') # thicker black lines
1818
rc('grid', c='0.5', ls='-', lw=0.5) # solid gray grid lines
1919
rc('savefig', dpi=300) # higher res outputs
2020

examples/misc/demo_agg_filter.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
import numpy as np
1010
import matplotlib.cm as cm
1111
import matplotlib.mlab as mlab
12+
import matplotlib.transforms as mtransforms
13+
from matplotlib.colors import LightSource
14+
from matplotlib.artist import Artist
1215

1316

1417
def smooth1d(x, window_len):
@@ -34,7 +37,7 @@ def smooth2d(A, sigma=3):
3437
class BaseFilter(object):
3538
def prepare_image(self, src_image, dpi, pad):
3639
ny, nx, depth = src_image.shape
37-
#tgt_image = np.zeros([pad*2+ny, pad*2+nx, depth], dtype="d")
40+
# tgt_image = np.zeros([pad*2+ny, pad*2+nx, depth], dtype="d")
3841
padded_src = np.zeros([pad*2 + ny, pad*2 + nx, depth], dtype="d")
3942
padded_src[pad:-pad, pad:-pad, :] = src_image[:, :, :]
4043

@@ -82,7 +85,7 @@ def get_pad(self, dpi):
8285
return int(self.sigma*3/72.*dpi)
8386

8487
def process_image(self, padded_src, dpi):
85-
#offsetx, offsety = int(self.offsets[0]), int(self.offsets[1])
88+
# offsetx, offsety = int(self.offsets[0]), int(self.offsets[1])
8689
tgt_image = np.zeros_like(padded_src)
8790
aa = smooth2d(padded_src[:, :, -1]*self.alpha,
8891
self.sigma/72.*dpi)
@@ -106,9 +109,6 @@ def process_image(self, padded_src, dpi):
106109
return t2
107110

108111

109-
from matplotlib.colors import LightSource
110-
111-
112112
class LightFilter(BaseFilter):
113113
"simple gauss filter"
114114

@@ -160,9 +160,6 @@ def __call__(self, im, dpi):
160160
return new_im, offsetx, offsety
161161

162162

163-
from matplotlib.artist import Artist
164-
165-
166163
class FilteredArtistList(Artist):
167164
"""
168165
A simple container to draw filtered artist.
@@ -182,9 +179,6 @@ def draw(self, renderer):
182179
renderer.stop_rasterizing()
183180

184181

185-
import matplotlib.transforms as mtransforms
186-
187-
188182
def filtered_text(ax):
189183
# mostly copied from contour_demo.py
190184

@@ -281,9 +275,10 @@ def drop_shadow_patches(ax):
281275
rects1 = ax.bar(ind, menMeans, width, color='r', ec="w", lw=2)
282276

283277
womenMeans = (25, 32, 34, 20, 25)
284-
rects2 = ax.bar(ind + width + 0.1, womenMeans, width, color='y', ec="w", lw=2)
278+
rects2 = ax.bar(ind + width + 0.1, womenMeans, width,
279+
color='y', ec="w", lw=2)
285280

286-
#gauss = GaussianFilter(1.5, offsets=(1,1), )
281+
# gauss = GaussianFilter(1.5, offsets=(1,1), )
287282
gauss = DropShadowFilter(5, offsets=(1, 1), )
288283
shadow = FilteredArtistList(rects1 + rects2, gauss)
289284
ax.add_artist(shadow)

0 commit comments

Comments
 (0)
0