import matplotlib.pyplot as plt import numpy as np dist_A = np.zeros(20) dist_S = np.zeros(20) dist_S[0] = 100 #Turtle start 100 meters ahead number = 100 # Fill array with numbers [0, 100, 10, 1 ,0.1, 0.01, ...] for i in range(1, 20): dist_A[i] = dist_A[i-1] + number number = number/10 # Reduce number with factor of 10 dist_S[i] = dist_S[i-1] + number plt.close('all') plt.figure(1, figsize=(12, 9)) plt.plot(dist_S - dist_A, 'o-', label=('dist_S - dist_A')) plt.legend() plt.xlabel('Index in array') plt.ylabel('[m]') plt.grid() # plt.savefig('plot_akilles.pdf') plt.show()