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

Skip to content

Commit b21b348

Browse files
Tillstendmcdougall
authored andcommitted
pep8 compliance
1 parent 24f537f commit b21b348

1 file changed

Lines changed: 15 additions & 14 deletions

File tree

lib/matplotlib/stackplot.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,21 @@ def stackplot(axes, x, *args, **kwargs):
5656

5757
baseline = kwargs.pop('baseline', 'zero')
5858
# Assume data passed has not been 'stacked', so stack it here.
59-
y_stack = np.cumsum(y, axis=0)
59+
stack = np.cumsum(y, axis=0)
6060

6161
r = []
6262
if baseline == 'zero':
6363
first_line = 0.
6464

6565
elif baseline == 'sym':
66-
first_line = -np.sum(y, 0) * 0.5
67-
y_stack += first_line[None, :]
66+
first_line = -np.sum(y, 0) * 0.5
67+
stack += first_line[None, :]
6868

6969
elif baseline == 'wiggle':
7070
m = y.shape[0]
7171
first_line = (y * (m - 0.5 - np.arange(0, m)[:, None])).sum(0)
7272
first_line /= -m
73-
y_stack += first_line
73+
stack += first_line
7474

7575
elif baseline == 'weighted_wiggle':
7676
#TODO: Vectorize this stuff.
@@ -83,29 +83,30 @@ def stackplot(axes, x, *args, **kwargs):
8383
for j in range(m):
8484
if i == 0:
8585
increase = y[j, i]
86-
moveUp = 0.5
86+
move_up = 0.5
8787
else:
88-
belowSize = 0.5 * y[j, i]
88+
below_size = 0.5 * y[j, i]
8989
for k in range(j + 1, m):
90-
belowSize += y[k, i]
90+
below_size += y[k, i]
9191
increase = y[j, i] - y[j, i - 1]
92-
moveUp = belowSize / total[i]
93-
center[i] += (moveUp - 0.5) * increase
92+
move_up = below_size / total[i]
93+
center[i] += (move_up - 0.5) * increase
9494
first_line = center - 0.5 * total
95-
y_stack += first_line
95+
stack += first_line
9696
else:
9797
errstr = "Baseline method %s not recognised. " % baseline
9898
errstr += "Expected 'zero', 'sym', 'wiggle' or 'weighted_wiggle'"
9999
raise ValueError(errstr)
100100

101101
# Color between x = 0 and the first array.
102-
r.append(axes.fill_between(x, first_line, y_stack[0,:],
102+
r.append(axes.fill_between(x, first_line, stack[0, :],
103103
facecolor=axes._get_lines.color_cycle.next(),
104104
**kwargs))
105105

106106
# Color between array i-1 and array i
107-
for i in xrange(len(y)-1):
108-
r.append(axes.fill_between(x, y_stack[i,: ], y_stack[i + 1, :],
109-
facecolor=axes._get_lines.color_cycle.next(),
107+
for i in xrange(len(y) - 1):
108+
color = axes._get_lines.color_cycle.next()
109+
r.append(axes.fill_between(x, stack[i, :], stack[i + 1, :],
110+
facecolor= color,
110111
**kwargs))
111112
return r

0 commit comments

Comments
 (0)