My problem is very similar to the one in: python - scatter plot with dates and 3rd variable as color
But I want the colors to vary acording to 3 set of values inside my 3rd variable.
for example:
#my 3rd variable consists of a column with these planet radii values:
radii
1 70
2 6
3 54
4 3
5 0.3
...
And I expect to vary the colors according to radii>8, 4< radii<8 and radii<4.
I've tried using the simple code, presented in the other question:
db=table_with_3_columns()
x=db['column a']
y=db['column b']
z=db['radii']
plt.scatter(x,y,c=z,s=30)
But I don't know how to specify the 'c' parameter for different sets inside z. I've also tried using:
a=[]
for i in db['radii']
if i>8:
a['bigradii']=i
elif i<4:
a['smallradii']=i
elif i<8 and i>4:
a['mediumradii']=i
return a
but I don't know how to proceed with that.
The result would be a scatter with the dots separated by colors guided by the values in the 3rd column 'radii', but all I get using the first code is all the dots black, or, by using the second code it tells me that i is a string, and I cannot put that on a list :(
How can I achieve that?