Scatter Plot with Conditions
This type of scatter plot is best performed in seaborn for Python.

# example from: https://python-graph-gallery.com/?s=scatter
# library &amp; dataset
import seaborn as sns
df = sns.load_dataset('iris')

# Use the 'hue' argument to provide a factor variable
sns.lmplot( x="sepal_length", y="sepal_width", data=df, fit_reg=False, hue='species', legend=False)

# Move the legend to an empty part of the plot
plt.legend(loc='lower right')


The keyword hue will designate which variable is the one which is used for labeling the data points. Also, have a look at the link provided for more examples.