To clarify, I have reviewed similar questions that were answered, such as this and this. However, these solutions seem to only work for lines that are composed of multiple points. In my case, I am wondering if this can be applied or if there's another way to do this for lines given two pairs of x,y coordinates. I am looking to create a gradient line between the two points in matplotlib in order to express directionality. A snippet of my code looks like this:
import matplotlib.pyplot as plt
fig = plt.figure(figsize=(8,14))
ax = plt.gca()
for coord in coords:
#coord is represented as [(x1,y1), (x2,y2)]
xcoords = [loc[0] for loc in coord]
ycoords = [loc[1] for loc in coord]
ax.plot(xcoords, ycoords, '.-', c='w')
Here's a snippit of the plot it produces:
The image it produces is fine, however, I would love to create a black-to-white transition line between the two points in order to express directionality. Any help would be appreciated.