1# Unique category labels: 'D', 'F', 'G', ...
2color_labels = df['color'].unique()
3
4# List of RGB triplets
5rgb_values = sns.color_palette("Set2", 8)
6
7# Map label to RGB
8color_map = dict(zip(color_labels, rgb_values))
9
10# Finally use the mapped values
11plt.scatter(df['carat'], df['price'], c=df['color'].map(color_map))