Browse Source

Do not use unecessarily many datapoints

The precision argument is not applicable to constant interpolation,
since it consists of straight lines.
pull/427/head
Hendrik Schawe 7 years ago
parent
commit
34479fa8c8
  1. 7
      pygal/interpolate.py

7
pygal/interpolate.py

@ -230,7 +230,7 @@ def trigonometric_interpolate(x, y, precision=250, **kwargs):
yield X, s
def constant_interpolate(x, y, precision=250, **kwargs):
def constant_interpolate(x, y, **kwargs):
n = len(x) - 1
delta_x = [x2 - x1 for x1, x2 in zip(x, x[1:])]
for i in range(n + 1):
@ -238,9 +238,8 @@ def constant_interpolate(x, y, precision=250, **kwargs):
if i == n or delta_x[i] == 0:
continue
for s in range(1, precision):
X = x[i] + s * delta_x[i] / precision
yield X, y[i]
X = x[i] + delta_x[i]
yield X, y[i]
INTERPOLATIONS = {

Loading…
Cancel
Save