I have three identical length lists for scatter plotting: x (float), y (float) and c (integer for colour), and would like to split up the x and y lists into subsets filtered by the colour value so that I can use a legend the delineate them in a plot
While I could achieve this with len(c) loops over the x and y lists, it is not very pythonic, and I was hoping someone could provide something a bit more elegant
I was thinking something like the following, but it's clearly not working
c_list = list(set(c))
xset = []
yset = []
for j in c_list:
xset.append([i for i in x if j in c])
yset.append([i for i in y if j in c])
Be gentle - I've only been learning Python for a week or so!
Thanks in advance