from day15.common import yield_numbers from matplotlib import pyplot as plt import numpy as np sequences = [ "0,1", "0,1,2", "1,2,3", "3,2,1", "0,13,16,17,1,10,6", ] for sequence in sequences: data = list(map(lambda x: (x[1],len(x[2]),len(x[2])/x[0]), yield_numbers(sequence, 20200))) data = np.array(data) fig, ax1 = plt.subplots() ax1.title.set_text(sequence) ax1.plot( data[:, :2], linestyle='none', marker='.', markersize=1 ) ax2 = ax1.twinx() ax2.plot( data[:, 2], linestyle='none', marker='.', markersize=1, color='r' ) ax2.set_yscale('log') plt.show()