can you help me a little bit i'm stuck somewhere in my python code. i'm sorry if my english is bad, but i'll try my best.
dict = {2: {20.934144973754883: 'red'},
8: {36.431842803955078: 'blue'},
9: {27.323692321777344: 'blue'},
15: {37.194934844970703: 'blue'},
18: {19.550689697265625: 'red'}}
y = []
x = []
for key,value in dict.items():
y.append(key)
for val,color in value.items():
x.append(val)
c.append(color)
plt.scatter(sorted(x),sorted(y),color = c)
To make a line of the data i sorted the x and y. But then when i scattered my plot, the colors where wrong. I know it's because i didn't sorted the colors. But if i try to sort them i fail. Because of the variable value:
value = {20.934144973754883: 'red'}
{36.431842803955078: 'blue'}
{27.323692321777344: 'blue'}
{37.194934844970703: 'blue'}
{19.550689697265625: 'red'}
You can't sort this. please help me, i don't know what to do