Coloring scatter plot points differently based on certain conditions

Can anyone help me with this question which I have asked in stackoverflow a few weeks back ?
Here’s the link : https://stackoverflow.com/questions/56289777/coloring-scatter-plot-points-differently-based-on-certain-conditions

Answered at https://stackoverflow.com/questions/56289777/coloring-scatter-plot-points-differently-based-on-certain-conditions/56425020#56425020