From 34479fa8c85f0082fa84ebafec85022aff9542f3 Mon Sep 17 00:00:00 2001 From: Hendrik Schawe Date: Fri, 8 Jun 2018 12:09:08 +0200 Subject: [PATCH] Do not use unecessarily many datapoints The precision argument is not applicable to constant interpolation, since it consists of straight lines. --- pygal/interpolate.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pygal/interpolate.py b/pygal/interpolate.py index 37b57cc..eddcacf 100644 --- a/pygal/interpolate.py +++ b/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 = {