Wie zeichnet man eine Linie (polygonale Kette) mit numpy / scipy / matplotlib mit minimaler Glättung
Ich versuche, eine Linie in matplotlib zu zeichnen. Ich suche nach der richtigen Art der Interpolation. Ich möchte so etwas
wo jede Linie geglättet wird. Ich habe verschiedene Kombinationen von scipy und matplotlib ausprobiert, wie z
x_new = np.arange(x, x_length, 1)
tck = interpolate.splrep(x, y, s=3)
y_new = interpolate.splev(x_new, tck, der=0)
ax.plot(x_new, y_new, color+lstyle)
aber das beste Ergebnis, das ich bekomme, ist
Die Linie repräsentierteine zunehmende Variable..es ist also eine falsche Darstellung. Was kann ich suchen?
Vielen Dank
Bearbeiten: Ich denke darüber nach, eine Methode von mir selbst zu implementieren, aber ich weiß nicht, ob dies bereits geschehen ist. Pseudocode ist der folgende
take x and y
calculate spline for each three points
x[0], x[1], x[2] ... x[1], x[2], x[3] ... and so on
for each y[n] sums every computation done for it and divide by number of
computations (i.e. y[1] is computed for triplette x[0..2] and x[1..3] so the
sum is divided by two (average for each point is taken as its value)