Skip to content

Commit d3dd8db

Browse files
orbitfoldwesm
authored andcommitted
Fixed for samples with odd number of attributes and label handling when they are not strings
1 parent c7835eb commit d3dd8db

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pandas/tools/plotting.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ def f(x):
149149
result += (x_even * sin(harmonic * x) +
150150
x_odd * cos(harmonic * x))
151151
harmonic += 1.0
152+
if len(amplitudes) % 2 != 0:
153+
result += amplitudes[-1] * sin(harmonic * x)
152154
return result
153155
return f
154156
def random_color(column):
@@ -167,9 +169,9 @@ def random_color(column):
167169
f = function(row)
168170
y = [f(t) for t in x]
169171
label = None
170-
if class_col[i] not in used_legends:
171-
label = class_col[i]
172-
used_legends.add(class_col[i])
172+
if str(class_col[i]) not in used_legends:
173+
label = str(class_col[i])
174+
used_legends.add(label)
173175
ax.plot(x, y, color=random_color(class_col[i]), label=label)
174176
ax.legend(loc='upper right')
175177
ax.grid()

0 commit comments

Comments
 (0)