for i in range(len(r)):
    plt.plot(r[i][0], r[i][1], c=(rgb_number(speeds[i]), 0, 1 - rgb_number(
        speeds[i])), linewidth=1)
plt.axis('off')
ax = plt.gca()
ax.set_xlim(0.0, width_of_im)
ax.set_ylim(height_of_im, 0.0)
plt.savefig(IMG_DIR + 'match.png', bbox_inches='tight', transparent='True')
Remove padding from matplotlib plotting