Skip to content

Commit 1171a96

Browse files
committed
fix some pep8 issues overseen by autopep8
1 parent 4a0f5f4 commit 1171a96

12 files changed

+59
-62
lines changed

examples/animation/double_pendulum_animated.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ def derivs(state, t):
2222
del_ = state[2]-state[0]
2323
den1 = (M1+M2)*L1 - M2*L1*cos(del_)*cos(del_)
2424
dydx[1] = (M2*L1*state[1]*state[1]*sin(del_)*cos(del_)
25-
+ M2*G*sin(state[2])*cos(del_) + M2*L2*state[3]*state[3]*sin(del_)
25+
+ M2*G*sin(state[2])*cos(del_)
26+
+ M2*L2*state[3]*state[3]*sin(del_)
2627
- (M1+M2)*G*sin(state[0]))/den1
2728

2829
dydx[2] = state[3]

examples/animation/subplots.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
from matplotlib.lines import Line2D
44
import matplotlib.animation as animation
55

6-
# This example uses subclassing, but there is no reason that the proper function
7-
# couldn't be set up and then use FuncAnimation. The code is long, but not
8-
# really complex. The length is due solely to the fact that there are a total
9-
# of 9 lines that need to be changed for the animation as well as 3 subplots
10-
# that need initial set up.
6+
# This example uses subclassing, but there is no reason that the proper
7+
# function couldn't be set up and then use FuncAnimation. The code is long, but
8+
# not really complex. The length is due solely to the fact that there are a
9+
# total of 9 lines that need to be changed for the animation as well as 3
10+
# subplots that need initial set up.
1111

1212

1313
class SubplotAnimation(animation.TimedAnimation):

examples/api/date_demo.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@
4141
datemax = datetime.date(r.date.max().year + 1, 1, 1)
4242
ax.set_xlim(datemin, datemax)
4343

44-
# format the coords message box
45-
4644

47-
def price(x): return '$%1.2f' % x
45+
# format the coords message box
46+
def price(x):
47+
return '$%1.2f' % x
4848
ax.format_xdata = mdates.DateFormatter('%Y-%m-%d')
4949
ax.format_ydata = price
5050
ax.grid(True)

examples/api/logo2.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,14 @@ def add_math_background():
2626

2727
text = []
2828
text.append(
29-
(r"$W^{3\beta}_{\delta_1 \rho_1 \sigma_2} = U^{3\beta}_{\delta_1 \rho_1} + \frac{1}{8 \pi 2} \int^{\alpha_2}_{\alpha_2} d \alpha^\prime_2 \left[\frac{ U^{2\beta}_{\delta_1 \rho_1} - \alpha^\prime_2U^{1\beta}_{\rho_1 \sigma_2} }{U^{0\beta}_{\rho_1 \sigma_2}}\right]$", (0.7, 0.2), 20))
30-
text.append((r"$\frac{d\rho}{d t} + \rho \vec{v}\cdot\nabla\vec{v} = -\nabla p + \mu\nabla^2 \vec{v} + \rho \vec{g}$",
29+
(r"$W^{3\beta}_{\delta_1 \rho_1 \sigma_2} = "
30+
r"U^{3\beta}_{\delta_1 \rho_1} + \frac{1}{8 \pi 2}"
31+
r"\int^{\alpha_2}_{\alpha_2} d \alpha^\prime_2 "
32+
r"\left[\frac{ U^{2\beta}_{\delta_1 \rho_1} - "
33+
r"\alpha^\prime_2U^{1\beta}_{\rho_1 \sigma_2} "
34+
r"}{U^{0\beta}_{\rho_1 \sigma_2}}\right]$", (0.7, 0.2), 20))
35+
text.append((r"$\frac{d\rho}{d t} + \rho \vec{v}\cdot\nabla\vec{v} "
36+
r"= -\nabla p + \mu\nabla^2 \vec{v} + \rho \vec{g}$",
3137
(0.35, 0.9), 20))
3238
text.append((r"$\int_{-\infty}^\infty e^{-x^2}dx=\sqrt{\pi}$",
3339
(0.15, 0.3), 25))
@@ -36,8 +42,8 @@ def add_math_background():
3642
text.append((r"$F_G = G\frac{m_1m_2}{r^2}$",
3743
(0.85, 0.7), 30))
3844
for eq, (x, y), size in text:
39-
ax.text(x, y, eq, ha='center', va='center', color="#11557c", alpha=0.25,
40-
transform=ax.transAxes, fontsize=size)
45+
ax.text(x, y, eq, ha='center', va='center', color="#11557c",
46+
alpha=0.25, transform=ax.transAxes, fontsize=size)
4147
ax.set_axis_off()
4248
return ax
4349

examples/api/mathtext_asarray.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,15 @@
22
Load a mathtext image as numpy array
33
"""
44

5-
import numpy as np
65
import matplotlib.mathtext as mathtext
76
import matplotlib.pyplot as plt
87
import matplotlib
98
matplotlib.rc('image', origin='upper')
109

1110
parser = mathtext.MathTextParser("Bitmap")
12-
13-
14-
parser.to_png(
15-
'test2.png', r'$\left[\left\lfloor\frac{5}{\frac{\left(3\right)}{4}} y\right)\right]$', color='green', fontsize=14, dpi=100)
16-
11+
parser.to_png('test2.png',
12+
r'$\left[\left\lfloor\frac{5}{\frac{\left(3\right)}{4}} '
13+
r'y\right)\right]$', color='green', fontsize=14, dpi=100)
1714

1815
rgba1, depth1 = parser.to_rgba(
1916
r'IQ: $\sigma_i=15$', color='blue', fontsize=20, dpi=200)

examples/api/radar_chart.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,11 @@ def example_data():
116116
# The following data is from the Denver Aerosol Sources and Health study.
117117
# See doi:10.1016/j.atmosenv.2008.12.017
118118
#
119-
# The data are pollution source profile estimates for five modeled pollution
120-
# sources (e.g., cars, wood-burning, etc) that emit 7-9 chemical species.
121-
# The radar charts are experimented with here to see if we can nicely
122-
# visualize how the modeled source profiles change across four scenarios:
119+
# The data are pollution source profile estimates for five modeled
120+
# pollution sources (e.g., cars, wood-burning, etc) that emit 7-9 chemical
121+
# species. The radar charts are experimented with here to see if we can
122+
# nicely visualize how the modeled source profiles change across four
123+
# scenarios:
123124
# 1) No gas-phase species present, just seven particulate counts on
124125
# Sulfate
125126
# Nitrate

examples/api/sankey_demo_rankine.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
"""Demonstrate the Sankey class with a practicle example of a Rankine power cycle.
1+
"""Demonstrate the Sankey class with a practicle example of a Rankine power
2+
cycle.
3+
24
"""
3-
import numpy as np
45
import matplotlib.pyplot as plt
56

67
from matplotlib.sankey import Sankey
78

89
fig = plt.figure(figsize=(8, 9))
910
ax = fig.add_subplot(1, 1, 1, xticks=[], yticks=[],
10-
title="Rankine Power Cycle: Example 8.6 from Moran and Shapiro\n"
11-
+ "\x22Fundamentals of Engineering Thermodynamics\x22, 6th ed., 2008")
11+
title="Rankine Power Cycle: Example 8.6 from Moran and "
12+
"Shapiro\n\x22Fundamentals of Engineering Thermodynamics "
13+
"\x22, 6th ed., 2008")
1214
Hdot = [260.431, 35.078, 180.794, 221.115, 22.700,
1315
142.361, 10.193, 10.210, 43.670, 44.312,
1416
68.631, 10.758, 10.758, 0.017, 0.642,

examples/api/skewt.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ def _set_lim_and_transforms(self):
128128
# coordinates thus performing the transform around the proper origin
129129
# We keep the pre-transAxes transform around for other users, like the
130130
# spines for finding bounds
131-
self.transDataToAxes = self.transScale + (self.transLimits +
132-
transforms.Affine2D().skew_deg(rot, 0))
131+
self.transDataToAxes = self.transScale + \
132+
self.transLimits + transforms.Affine2D().skew_deg(rot, 0)
133133

134134
# Create the full transform from Data to Pixels
135135
self.transData = self.transDataToAxes + self.transAxes
@@ -148,7 +148,6 @@ def _set_lim_and_transforms(self):
148148
if __name__ == '__main__':
149149
# Now make a simple example using the custom projection.
150150
from matplotlib.ticker import ScalarFormatter, MultipleLocator
151-
from matplotlib.collections import LineCollection
152151
import matplotlib.pyplot as plt
153152
from StringIO import StringIO
154153
import numpy as np
@@ -227,7 +226,8 @@ def _set_lim_and_transforms(self):
227226
107.8 15850 -64.1 -75.1 21 0.01 265 58 395.0 395.1 395.0
228227
105.0 16010 -64.7 -75.7 21 0.01 272 50 396.9 396.9 396.9
229228
103.0 16128 -62.9 -73.9 21 0.02 277 45 402.5 402.6 402.5
230-
100.0 16310 -62.5 -73.5 21 0.02 285 36 406.7 406.8 406.7'''
229+
100.0 16310 -62.5 -73.5 21 0.02 285 36 406.7 406.8 406.7
230+
'''
231231

232232
# Parse the data
233233
sound_data = StringIO(data_txt)

examples/axes_grid/demo_axes_divider.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,27 +97,25 @@ def demo():
9797
fig1 = plt.figure(1, (6, 6))
9898
fig1.clf()
9999

100-
## PLOT 1
100+
# PLOT 1
101101
# simple image & colorbar
102102
ax = fig1.add_subplot(2, 2, 1)
103103
demo_simple_image(ax)
104104

105-
## PLOT 2
105+
# PLOT 2
106106
# image and colorbar whose location is adjusted in the drawing time.
107107
# a hard way
108108

109109
demo_locatable_axes_hard(fig1)
110110

111-
112-
## PLOT 3
111+
# PLOT 3
113112
# image and colorbar whose location is adjusted in the drawing time.
114113
# a easy way
115114

116115
ax = fig1.add_subplot(2, 2, 3)
117116
demo_locatable_axes_easy(ax)
118117

119-
120-
## PLOT 4
118+
# PLOT 4
121119
# two images side by side with fixed padding.
122120

123121
ax = fig1.add_subplot(2, 2, 4)

examples/axes_grid/demo_curvelinear_grid.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import numpy as np
2-
#from matplotlib.path import Path
32

43
import matplotlib.pyplot as plt
54
import matplotlib.cbook as cbook
65

7-
from mpl_toolkits.axisartist.grid_helper_curvelinear import GridHelperCurveLinear
86
from mpl_toolkits.axisartist import Subplot
9-
107
from mpl_toolkits.axisartist import SubplotHost, \
118
ParasiteAxesAuxTrans
9+
from mpl_toolkits.axisartist.grid_helper_curvelinear import \
10+
GridHelperCurveLinear
1211

1312

1413
def curvelinear_test1(fig):

examples/axes_grid/demo_curvelinear_grid2.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import numpy as np
2-
#from matplotlib.path import Path
3-
42
import matplotlib.pyplot as plt
53

6-
from mpl_toolkits.axes_grid.grid_helper_curvelinear import GridHelperCurveLinear
4+
from mpl_toolkits.axes_grid.grid_helper_curvelinear import \
5+
GridHelperCurveLinear
76
from mpl_toolkits.axes_grid.axislines import Subplot
87

98
import mpl_toolkits.axes_grid.angle_helper as angle_helper

examples/axes_grid/demo_floating_axes.py

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ def setup_axes2(fig, rect):
3434
With custom locator and formatter.
3535
Note that the extreme values are swapped.
3636
"""
37-
38-
#tr_scale = Affine2D().scale(np.pi/180., 1.)
39-
4037
tr = PolarAxes.PolarTransform()
4138

4239
pi = np.pi
@@ -48,13 +45,12 @@ def setup_axes2(fig, rect):
4845

4946
grid_locator2 = MaxNLocator(2)
5047

51-
grid_helper = floating_axes.GridHelperCurveLinear(tr,
52-
extremes=(.5*pi, 0, 2, 1),
53-
grid_locator1=grid_locator1,
54-
grid_locator2=grid_locator2,
55-
tick_formatter1=tick_formatter1,
56-
tick_formatter2=None,
57-
)
48+
grid_helper = floating_axes.GridHelperCurveLinear(
49+
tr, extremes=(.5*pi, 0, 2, 1),
50+
grid_locator1=grid_locator1,
51+
grid_locator2=grid_locator2,
52+
tick_formatter1=tick_formatter1,
53+
tick_formatter2=None)
5854

5955
ax1 = floating_axes.FloatingSubplot(fig, rect, grid_helper=grid_helper)
6056
fig.add_subplot(ax1)
@@ -91,14 +87,12 @@ def setup_axes3(fig, rect):
9187

9288
ra0, ra1 = 8.*15, 14.*15
9389
cz0, cz1 = 0, 14000
94-
grid_helper = floating_axes.GridHelperCurveLinear(tr,
95-
extremes=(
96-
ra0, ra1, cz0, cz1),
97-
grid_locator1=grid_locator1,
98-
grid_locator2=grid_locator2,
99-
tick_formatter1=tick_formatter1,
100-
tick_formatter2=None,
101-
)
90+
grid_helper = floating_axes.GridHelperCurveLinear(
91+
tr, extremes=(ra0, ra1, cz0, cz1),
92+
grid_locator1=grid_locator1,
93+
grid_locator2=grid_locator2,
94+
tick_formatter1=tick_formatter1,
95+
tick_formatter2=None)
10296

10397
ax1 = floating_axes.FloatingSubplot(fig, rect, grid_helper=grid_helper)
10498
fig.add_subplot(ax1)
@@ -138,7 +132,7 @@ def setup_axes3(fig, rect):
138132

139133
# theta = np.random.rand(10) #*.5*np.pi
140134
# radius = np.random.rand(10) #+1.
141-
#aux_ax1.scatter(theta, radius)
135+
# aux_ax1.scatter(theta, radius)
142136

143137
ax2, aux_ax2 = setup_axes2(fig, 132)
144138

0 commit comments

Comments
 (0)