De l’art en python avec le module matplotlib.pyplot par Christophe Navaux
# script de Christophe Navaux, @AlgoMaths # https://twitter.com/AlgoMaths/status/1459863863466336257 import math from kandinsky import set_pixel #import matplotlib.pyplot as plt def draw_line(x1, y1, x2, y2, c): m, a1, b1, a2, b2 = 0, int(x1), int(y1), int(x2), int(y2) if (x2 - x1) ** 2 < (y2 - y1) ** 2: m, a1, a2, b1, b2 = 1, b1, b2, a1, a2 if min(a1, a2) != a1: a1, b1, a2, b2 = a2, b2, a1, b1 for a in range(a1, a2 + 1): b = int(b1 + (b2 - b1) * (a - a1) / ((a2 - a1) or 1)) set_pixel((a, b)[m], (b, a)[m], c) def u(n): return (n+0.15)*math.sqrt(n) def coords_2_pixels(x, y): k=.55 return x*k+160, 98-y*k def plot(n): x, y = 0, 0 px, py = coords_2_pixels(x, y) for k in range (1,n+1): x_old, y_old, px_old, py_old = x, y, px, py x = x + math.cos(2*math.pi*u(k)) y = y + math.sin(2*math.pi*u(k)) px, py = coords_2_pixels(x, y) draw_line(px_old, py_old, px, py, (0, 0, 255)) #Programme principal #N représente le nombre de points tracés N = 100000 plot(N)