Matplotlib connect scatterplot points with line - Python
Checked this out and their solution was very simple, use plt.plot(x_coordinates, y_coordinates, '-o') but I have a list of colors that i'm using so I can't use this method. They are RGB colors. (Also not sure why colors are alternating within the same series)
How can I connect these points with lines that are the same color as the markers?
import matplotlib.pyplot as plt
import random
x_coordinates = [(range(1,4))]*2
y_coordinates = [[3,4,5],[2,2,2]]
color_map = []
for i in range(0,len(x_coordinates)):
r = lambda: random.randint(0,255)
rgb_hex = ('#%02X%02X%02X' % (r(),r(),r()))
color_map.append(rgb_hex)
plt.scatter(x_coordinates,y_coordinates,c=color_map)
plt.show()