How to plot a gradient color line in matplotlib?
Note that if you have many points, calling plt.plot for each line segment can be quite slow. It’s more efficient to use a LineCollection object. Using the colorline recipe you could do the following: import matplotlib.pyplot as plt import numpy as np import matplotlib.collections as mcoll import matplotlib.path as mpath def colorline( x, y, z=None, … Read more