I thought the easiest way to make a scatterplot with N different series (like in excel) would be to have 3 lists:i) x_coordinates would have N lists containing the X positions; ii) y_coordinates would also have N lists containing the Y positions; and iii) color_map would have N elements containing the different RGB colors per series.
My problem is that the order gets weird on plotting the colors for the markers. Why is this happening and how do I fix it?
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()
Lists for x/y coordinates and colors
[[1, 2, 3], [1, 2, 3]] #x
[[3, 4, 5], [2, 2, 2]] #y
['#E6764F', '#A12678'] #colors